2002-10-09 16:36:47

by Denis Vlasenko

[permalink] [raw]
Subject: Looking for testers with these NICs

I'm looking for people who is brave (or stupid) enough to try 2.5
and who has network card(s) driven by one of the following drivers:

3c505.c
3c515.c
82596.c
at1700.c
depca.c
ewrk3.c
lp486e.c
ni5010.c
ni65.c
smc9194.c

These drivers currently don't compile. I'm fixing them but
can't test on a live hardware. Anyone?
--
vda


2002-10-09 16:54:58

by Alan

[permalink] [raw]
Subject: Re: Looking for testers with these NICs

On Wed, 2002-10-09 at 22:31, Denis Vlasenko wrote:
> depca.c

Already done

> ewrk3.c
> lp486e.c
> ni5010.c
> ni65.c
> smc9194.c
>
> These drivers currently don't compile. I'm fixing them but
> can't test on a live hardware. Anyone?

You may want to merge the 2.4 changes as you go. For lp486e you may just
have to pray, its an unusual 486 onboard ethernet. I know 3 people who
have one, and one (mine) burned out the psu and died

2002-10-09 17:09:22

by Adam Kropelin

[permalink] [raw]
Subject: Re: Looking for testers with these NICs

On Wed, Oct 09, 2002 at 07:31:17PM -0200, Denis Vlasenko wrote:
> ewrk3.c

I've got a few of these laying around. Send whatever patches you want tested
and I'll give it a shot.

--Adam

2002-10-09 17:44:20

by Denis Vlasenko

[permalink] [raw]
Subject: Re: Looking for testers with these NICs

On 9 October 2002 15:14, Adam Kropelin wrote:
> On Wed, Oct 09, 2002 at 07:31:17PM -0200, Denis Vlasenko wrote:
> > ewrk3.c
>
> I've got a few of these laying around. Send whatever patches you want
> tested and I'll give it a shot.

Please do your best in trying to break it, especially since you say you have
more than one. Can you plug them all in one box?

I'd suggest SMP/preempt heavy IO. Is there stress test software for NICs?
What is pktgen?
--
vda

diff -u --recursive linux-2.5.40org/drivers/net/ewrk3.c linux-2.5.40/drivers/net/ewrk3.c
--- linux-2.5.40org/drivers/net/ewrk3.c Tue Oct 1 05:06:58 2002
+++ linux-2.5.40/drivers/net/ewrk3.c Thu Oct 3 12:09:46 2002
@@ -930,6 +930,7 @@
spin_unlock(&lp->hw_lock);
}

+/* Called with lp->hw_lock held */
static int ewrk3_rx(struct net_device *dev)
{
struct ewrk3_private *lp = (struct ewrk3_private *) dev->priv;
@@ -1055,8 +1056,9 @@
}

/*
- ** Buffer sent - check for TX buffer errors.
- */
+** Buffer sent - check for TX buffer errors.
+** Called with lp->hw_lock held
+*/
static int ewrk3_tx(struct net_device *dev)
{
struct ewrk3_private *lp = (struct ewrk3_private *) dev->priv;
@@ -1631,6 +1633,7 @@
u_long iobase = dev->base_addr;
int i, j, status = 0;
u_char csr;
+ unsigned long flags;
union ewrk3_addr {
u_char addr[HASH_TABLE_LEN * ETH_ALEN];
u_short val[(HASH_TABLE_LEN * ETH_ALEN) >> 1];
@@ -1745,19 +1748,26 @@
}

break;
- case EWRK3_GET_STATS: /* Get the driver statistics */
- cli();
- ioc->len = sizeof(lp->pktStats);
- if (copy_to_user(ioc->data, &lp->pktStats, ioc->len))
- status = -EFAULT;
- sti();
+ case EWRK3_GET_STATS: { /* Get the driver statistics */
+ typeof(lp->pktStats) *tmp_stats =
+ kmalloc(sizeof(lp->pktStats), GFP_KERNEL);
+ if (!tmp_stats) return -ENOMEM;
+
+ spin_lock_irqsave(&lp->hw_lock, flags);
+ memcpy(tmp_stats, &lp->pktStats, sizeof(lp->pktStats));
+ spin_unlock_irqrestore(&lp->hw_lock, flags);

+ ioc->len = sizeof(lp->pktStats);
+ if (copy_to_user(ioc->data, tmp_stats, sizeof(lp->pktStats)))
+ status = -EFAULT;
+ kfree(tmp_stats);
break;
+ }
case EWRK3_CLR_STATS: /* Zero out the driver statistics */
if (capable(CAP_NET_ADMIN)) {
- cli();
+ spin_lock_irqsave(&lp->hw_lock, flags);
memset(&lp->pktStats, 0, sizeof(lp->pktStats));
- sti();
+ spin_unlock_irqrestore(&lp->hw_lock,flags);
} else {
status = -EPERM;
}

2002-10-09 17:52:23

by Martin Josefsson

[permalink] [raw]
Subject: Re: Looking for testers with these NICs

On Thu, 2002-10-10 at 00:37, Denis Vlasenko wrote:

> I'd suggest SMP/preempt heavy IO. Is there stress test software for NICs?
> What is pktgen?

A kernelmodule that's capable of generating over a million packets per
second on a fast enough machine. It stresstests NIC's and NIC-drivers a
lot.

--
/Martin

Never argue with an idiot. They drag you down to their level, then beat
you with experience.

2002-10-09 18:15:16

by Ben Greear

[permalink] [raw]
Subject: Re: Looking for testers with these NICs

Denis Vlasenko wrote:
> On 9 October 2002 15:14, Adam Kropelin wrote:
>
>>On Wed, Oct 09, 2002 at 07:31:17PM -0200, Denis Vlasenko wrote:
>>
>>>ewrk3.c
>>
>>I've got a few of these laying around. Send whatever patches you want
>>tested and I'll give it a shot.
>
>
> Please do your best in trying to break it, especially since you say you have
> more than one. Can you plug them all in one box?
>
> I'd suggest SMP/preempt heavy IO. Is there stress test software for NICs?
> What is pktgen?

pktgen will definately stress the nics. Try sending to yourself
as well so you can test the pkt receive code..it's normally the weakest.

Ben

> --
> vda
>
> diff -u --recursive linux-2.5.40org/drivers/net/ewrk3.c linux-2.5.40/drivers/net/ewrk3.c
> --- linux-2.5.40org/drivers/net/ewrk3.c Tue Oct 1 05:06:58 2002
> +++ linux-2.5.40/drivers/net/ewrk3.c Thu Oct 3 12:09:46 2002
> @@ -930,6 +930,7 @@
> spin_unlock(&lp->hw_lock);
> }
>
> +/* Called with lp->hw_lock held */
> static int ewrk3_rx(struct net_device *dev)
> {
> struct ewrk3_private *lp = (struct ewrk3_private *) dev->priv;
> @@ -1055,8 +1056,9 @@
> }
>
> /*
> - ** Buffer sent - check for TX buffer errors.
> - */
> +** Buffer sent - check for TX buffer errors.
> +** Called with lp->hw_lock held
> +*/
> static int ewrk3_tx(struct net_device *dev)
> {
> struct ewrk3_private *lp = (struct ewrk3_private *) dev->priv;
> @@ -1631,6 +1633,7 @@
> u_long iobase = dev->base_addr;
> int i, j, status = 0;
> u_char csr;
> + unsigned long flags;
> union ewrk3_addr {
> u_char addr[HASH_TABLE_LEN * ETH_ALEN];
> u_short val[(HASH_TABLE_LEN * ETH_ALEN) >> 1];
> @@ -1745,19 +1748,26 @@
> }
>
> break;
> - case EWRK3_GET_STATS: /* Get the driver statistics */
> - cli();
> - ioc->len = sizeof(lp->pktStats);
> - if (copy_to_user(ioc->data, &lp->pktStats, ioc->len))
> - status = -EFAULT;
> - sti();
> + case EWRK3_GET_STATS: { /* Get the driver statistics */
> + typeof(lp->pktStats) *tmp_stats =
> + kmalloc(sizeof(lp->pktStats), GFP_KERNEL);
> + if (!tmp_stats) return -ENOMEM;
> +
> + spin_lock_irqsave(&lp->hw_lock, flags);
> + memcpy(tmp_stats, &lp->pktStats, sizeof(lp->pktStats));
> + spin_unlock_irqrestore(&lp->hw_lock, flags);
>
> + ioc->len = sizeof(lp->pktStats);
> + if (copy_to_user(ioc->data, tmp_stats, sizeof(lp->pktStats)))
> + status = -EFAULT;
> + kfree(tmp_stats);
> break;
> + }
> case EWRK3_CLR_STATS: /* Zero out the driver statistics */
> if (capable(CAP_NET_ADMIN)) {
> - cli();
> + spin_lock_irqsave(&lp->hw_lock, flags);
> memset(&lp->pktStats, 0, sizeof(lp->pktStats));
> - sti();
> + spin_unlock_irqrestore(&lp->hw_lock,flags);
> } else {
> status = -EPERM;
> }
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>


--
Ben Greear <[email protected]> <Ben_Greear AT excite.com>
President of Candela Technologies Inc http://www.candelatech.com
ScryMUD: http://scry.wanfear.com http://scry.wanfear.com/~greear


2002-10-09 19:02:27

by Adam Kropelin

[permalink] [raw]
Subject: Re: Looking for testers with these NICs

On Wed, Oct 09, 2002 at 08:37:48PM -0200, Denis Vlasenko wrote:
> On 9 October 2002 15:14, Adam Kropelin wrote:
> > On Wed, Oct 09, 2002 at 07:31:17PM -0200, Denis Vlasenko wrote:
> > > ewrk3.c
> >
> > I've got a few of these laying around. Send whatever patches you want
> > tested and I'll give it a shot.
>
> Please do your best in trying to break it, especially since you say you have
> more than one. Can you plug them all in one box?
>
> I'd suggest SMP/preempt heavy IO. Is there stress test software for NICs?
> What is pktgen?

These are ISA nics and my SMP box has a lot of other hardware in it right now,
but I'll see what I can do. I haven't tried to do unreasonable things with old
hardware in a while so it should be good for a grin, anyway.

I'll report my findings.

--Adam

2002-10-09 19:03:52

by Derek Fawcus

[permalink] [raw]
Subject: Re: Looking for testers with these NICs

On Wed, Oct 09, 2002 at 07:31:17PM -0200, Denis Vlasenko wrote:
> ni65.c

I've got some of these knocking about, but rather than use that driver,
I have a (quite old) patch, that allows the normal lance driver to be
used. The patch dates back from 1.3.x, but I think I may have a more
recent version around.

DF

2002-10-10 01:48:27

by Adam Kropelin

[permalink] [raw]
Subject: [PATCH] ewrk3: Add support for multiple NICs when modular (WAS: Looking for testers...)

Testing is in progress... Three NICs, 2 CPU SMP, preempt enabled. No problems so
far. For my own convenience I wanted support for multiple NICs when the driver
is built as a module, so here's a fairly simple patch to add that capability.
Against 2.5.41 + your cli/sti removal patch.

--Adam

--- linux-2.5.41/drivers/net/ewrk3.c Wed Oct 9 21:29:15 2002
+++ linux-2.5.41-fix2/drivers/net/ewrk3.c Wed Oct 9 21:40:23 2002
@@ -76,6 +76,7 @@
kernel with the ewrk3 configuration turned off and reboot.
5) insmod ewrk3.o
[Alan Cox: Changed this so you can insmod ewrk3.o irq=x io=y]
+ [Adam Kropelin: now accepts irq=x1,x2 io=y1,y2 for multiple cards]
6) run the net startup bits for your new eth?? interface manually
(usually /etc/rc.inet[12] at boot time).
7) enjoy!
@@ -130,10 +131,12 @@
Add new multicasting code.
0.41 20-Jan-96 Fix IRQ set up problem reported by
<[email protected]>.
- 0.42 22-Apr-96 Fix alloc_device() bug <[email protected]>
- 0.43 16-Aug-96 Update alloc_device() to conform to de4x5.c
- 0.44 08-Nov-01 use library crc32 functions <[email protected]>
- 0.45 19-Jul-02 fix unaligned access on alpha <[email protected]>
+ 0.42 22-Apr-96 Fix alloc_device() bug <[email protected]>
+ 0.43 16-Aug-96 Update alloc_device() to conform to de4x5.c
+ 0.44 08-Nov-01 use library crc32 functions <[email protected]>
+ 0.45 19-Jul-02 fix unaligned access on alpha <[email protected]>
+ 0.46 10-Oct-02 cli/sti removal <[email protected]>
+ Multiple NIC support when module <[email protected]>

=========================================================================
*/
@@ -167,7 +170,7 @@
#include "ewrk3.h"

static char version[] __initdata =
-"ewrk3.c:v0.43a 2001/02/04 [email protected]\n";
+"ewrk3.c:v0.46 2002/10/09 [email protected]\n";

#ifdef EWRK3_DEBUG
static int ewrk3_debug = EWRK3_DEBUG;
@@ -196,6 +199,7 @@
#define EWRK3_IOP_INC 0x20 /* I/O address increment */
#define EWRK3_TOTAL_SIZE 0x20 /* required I/O address length */

+/* If you change this, remember to also change MODULE_PARM array limits */
#ifndef MAX_NUM_EWRK3S
#define MAX_NUM_EWRK3S 21
#endif
@@ -1853,35 +1857,62 @@
}

#ifdef MODULE
-static struct net_device thisEthwrk;
-static int io = 0x300; /* <--- EDIT THESE LINES FOR YOUR CONFIGURATION */
-static int irq = 5; /* or use the insmod io= irq= options */
-
-MODULE_PARM(io, "i");
-MODULE_PARM(irq, "i");
-MODULE_PARM_DESC(io, "EtherWORKS 3 I/O base address");
-MODULE_PARM_DESC(irq, "EtherWORKS 3 IRQ number");
+static struct net_device *ewrk3_devs[MAX_NUM_EWRK3S];
+static int ndevs;
+static int io[MAX_NUM_EWRK3S+1] = { 0x300, 0, }; /* <--- EDIT THESE LINES FOR YOUR CONFIGURATION */
+static int irq[MAX_NUM_EWRK3S+1] = { 5, 0, }; /* or use the insmod io= irq= options */
+
+/* '21' below should really be 'MAX_NUM_EWRK3S' */
+MODULE_PARM(io, "0-21i");
+MODULE_PARM(irq, "0-21i");
+MODULE_PARM_DESC(io, "EtherWORKS 3 I/O base address(es)");
+MODULE_PARM_DESC(irq, "EtherWORKS 3 IRQ number(s)");

int init_module(void)
{
- thisEthwrk.base_addr = io;
- thisEthwrk.irq = irq;
- thisEthwrk.init = ewrk3_probe;
- if (register_netdev(&thisEthwrk) != 0)
- return -EIO;
- return 0;
+ int i=0;
+
+ while( io[i] && irq[i] ) {
+ ewrk3_devs[ndevs] = kmalloc(sizeof(struct net_device), GFP_KERNEL);
+ if (!ewrk3_devs[ndevs])
+ goto error;
+ memset(ewrk3_devs[ndevs], 0, sizeof(struct net_device));
+ ewrk3_devs[ndevs]->base_addr = io[i];
+ ewrk3_devs[ndevs]->irq = irq[i];
+ ewrk3_devs[ndevs]->init = ewrk3_probe;
+
+ if (register_netdev(ewrk3_devs[ndevs]) == 0)
+ ndevs++;
+ else
+ kfree(ewrk3_devs[ndevs]);
+
+ i++;
+ }
+
+ return ndevs ? 0 : -EIO;
+
+error:
+ cleanup_module();
+ return -ENOMEM;
}

void cleanup_module(void)
{
- unregister_netdev(&thisEthwrk);
- if (thisEthwrk.priv) {
- kfree(thisEthwrk.priv);
- thisEthwrk.priv = NULL;
- }
- thisEthwrk.irq = 0;
+ int i;

- release_region(thisEthwrk.base_addr, EWRK3_TOTAL_SIZE);
+ for( i=0; i<ndevs; i++ )
+ {
+ unregister_netdev(ewrk3_devs[i]);
+ if (ewrk3_devs[i]->priv) {
+ kfree(ewrk3_devs[i]->priv);
+ ewrk3_devs[i]->priv = NULL;
+ }
+ ewrk3_devs[i]->irq = 0;
+
+ release_region(ewrk3_devs[i]->base_addr, EWRK3_TOTAL_SIZE);
+ kfree(ewrk3_devs[i]);
+ ewrk3_devs[i] = NULL;
+ }
}
#endif /* MODULE */
MODULE_LICENSE("GPL");

--- linux-2.5.41/Documentation/networking/ewrk3.txt Mon Mar 18 15:37:08 2002
+++ linux-2.5.41-fix2/Documentation/networking/ewrk3.txt Wed Oct 9 21:44:24 2002
@@ -24,6 +24,7 @@
kernel with the ewrk3 configuration turned off and reboot.
5) insmod ewrk3.o
[Alan Cox: Changed this so you can insmod ewrk3.o irq=x io=y]
+ [Adam Kropelin: Multiple cards now supported by irq=x1,x2 io=y1,y2]
6) run the net startup bits for your new eth?? interface manually
(usually /etc/rc.inet[12] at boot time).
7) enjoy!

2002-10-10 06:38:53

by Denis Vlasenko

[permalink] [raw]
Subject: Re: Looking for testers with these NICs

On 9 October 2002 17:05, Derek Fawcus wrote:
> On Wed, Oct 09, 2002 at 07:31:17PM -0200, Denis Vlasenko wrote:
> > ni65.c
>
> I've got some of these knocking about, but rather than use that
> driver, I have a (quite old) patch, that allows the normal lance
> driver to be used. The patch dates back from 1.3.x, but I think I
> may have a more recent version around.

Well, if you want, give this a spin. Can you test it on
SMP or preempt kernel?

diff -u --recursive linux-2.5.40org/drivers/net/ni65.c linux-2.5.40/drivers/net/ni65.c
--- linux-2.5.40org/drivers/net/ni65.c Thu Oct 3 12:08:00 2002
+++ linux-2.5.40/drivers/net/ni65.c Wed Oct 9 10:35:18 2002
@@ -176,6 +176,9 @@
#define writedatareg(val) { writereg(val,CSR0); }
#endif

+/* Not to be confused with priv->lock */
+static spinlock_t irq_lock = SPIN_LOCK_UNLOCKED;
+
static unsigned char ni_vendor[] = { 0x02,0x07,0x01 };

static struct card {
@@ -409,7 +412,7 @@
p->features = 0x0;
}

- if(test_bit(0,&cards[i].config)) {
+ if(test_bit(0,(unsigned long*)(&cards[i].config))) {
dev->irq = irqtab[(inw(ioaddr+L_CONFIG)>>2)&3];
dev->dma = dmatab[inw(ioaddr+L_CONFIG)&3];
printk("IRQ %d (from card), DMA %d (from card).\n",dev->irq,dev->dma);
@@ -420,7 +423,7 @@
int dma_channels = ((inb(DMA1_STAT_REG) >> 4) & 0x0f) | (inb(DMA2_STAT_REG) & 0xf0);
for(i=1;i<5;i++) {
int dma = dmatab[i];
- if(test_bit(dma,&dma_channels) || request_dma(dma,"ni6510"))
+ if(test_bit(dma,(unsigned long*)&dma_channels) || request_dma(dma,"ni6510"))
continue;

flags=claim_dma_lock();
@@ -1118,8 +1121,7 @@
(skb->len > T_BUF_SIZE) ? T_BUF_SIZE : skb->len);
dev_kfree_skb (skb);

- save_flags(flags);
- cli();
+ spin_lock_irqsave(&irq_lock, flags);

tmdp = p->tmdhead + p->tmdnum;
tmdp->u.buffer = (u32) isa_virt_to_bus(p->tmdbounce[p->tmdbouncenum]);
@@ -1128,8 +1130,7 @@
#ifdef XMT_VIA_SKB
}
else {
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&irq_lock, flags);

tmdp = p->tmdhead + p->tmdnum;
tmdp->u.buffer = (u32) isa_virt_to_bus(skb->data);
@@ -1150,7 +1151,7 @@
p->lock = 0;
dev->trans_start = jiffies;

- restore_flags(flags);
+ spin_unlock_irqrestore(&irq_lock, flags);
}

return 0;

2002-10-10 06:52:40

by Denis Vlasenko

[permalink] [raw]
Subject: Re: Looking for testers with these NICs

On 9 October 2002 15:57, Martin Josefsson wrote:
> On Thu, 2002-10-10 at 00:37, Denis Vlasenko wrote:
> > I'd suggest SMP/preempt heavy IO. Is there stress test software for
> > NICs? What is pktgen?
>
> A kernelmodule that's capable of generating over a million packets
> per second on a fast enough machine. It stresstests NIC's and
> NIC-drivers a lot.

Indeed, I see it in 2.4, but where it has gone from 2.5?!
--
vda

2002-10-11 00:48:02

by Adam Kropelin

[permalink] [raw]
Subject: Re: Looking for testers with these NICs

On Wed, Oct 09, 2002 at 08:37:48PM -0200, Denis Vlasenko wrote:
> On 9 October 2002 15:14, Adam Kropelin wrote:
> > On Wed, Oct 09, 2002 at 07:31:17PM -0200, Denis Vlasenko wrote:
> > > ewrk3.c
> >
> > I've got a few of these laying around. Send whatever patches you want
> > tested and I'll give it a shot.
>
> Please do your best in trying to break it, especially since you say you have
> more than one. Can you plug them all in one box?
>
> I'd suggest SMP/preempt heavy IO. Is there stress test software for NICs?

I've finished beating the heck out of this driver. Over 12 hours of pounding
simultaneously on three NICs in a 2x SMP box running with preempt enabled and
not a single oops, BUG(), or deadlock. I'd say the driver is pretty solid at
this point; vda's locking patches seem to be safe.

As a sidenote, the max throughput I was able to achieve across three cards was
about 1.4 MBytes/sec. A single card could do about 800 KBytes sec; 2 together
got to 1.2 MBytes/sec. Heavy CPU utilization the whole way, of course, since
these cards do not use DMA.

--Adam