lkml.org 
[lkml]   [2000]   [Feb]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patches in this message
/
From
SubjectPlease test D-Link parport patches
Date
Hi guys!

Long time, no see...

I'm bouncing around the globe most of the time so I have not had the
time to keep up with Linux kernel development, the way I used to :-(

I saw a note from Dave M about changes for network drivers, and since
I still feel some parental responsibilities for the D-Link parallel port
Ethernet drivers (de600 and de620), I have prepared the included patch.

OK, I have _NOT_ tested the patches, in any way, partly due to lack of
time, but mostly since I do not have my old trusty adapters with me on
my travels anymore. Really.

After I wrote these drivers they invented PCMCIA. Good stuff. Try it :-)

So, if _someone_ is still using these old clunkers, PLEASE check if
the patches are OK for 2.3.42-8 (and later).


Cheers,

Bjorn Ekwall <bj0rn@blox.se>



--- linux-2.3.42/drivers/net/de600.c.org Thu Feb 10 23:36:54 2000
+++ linux-2.3.42/drivers/net/de600.c Thu Feb 10 23:57:39 2000
@@ -348,7 +348,6 @@
}

MOD_INC_USE_COUNT;
- dev->start = 1;
if (adapter_init(dev)) {
return 1;
}
@@ -369,9 +368,8 @@
de600_put_command(0);
select_prn();

- if (dev->start) {
+ if (test_bit(LINK_STATE_START, &dev->state)) { /* perhaps not needed? */
free_irq(DE600_IRQ, dev);
- dev->start = 0;
MOD_DEC_USE_COUNT;
}
return 0;
@@ -400,6 +398,7 @@
static int
de600_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
+ unsigned long flags;
int transmit_from;
int len;
int tickssofar;
@@ -429,6 +428,7 @@
if ((len = skb->len) < RUNT)
len = RUNT;

+ save_flags(flags);
cli();
select_nic();
tx_fifo[tx_fifo_in] = transmit_from = tx_page_adr(tx_fifo_in) - len;
@@ -440,7 +440,7 @@
de600_read_byte(READ_DATA, dev);
if (was_down || (de600_read_byte(READ_DATA, dev) != 0xde)) {
if (adapter_init(dev)) {
- sti();
+ restore_flags(flags);
return 1;
}
}
@@ -452,17 +452,20 @@

if (free_tx_pages-- == TX_PAGES) { /* No transmission going on */
dev->trans_start = jiffies;
- dev->tbusy = 0; /* allow more packets into adapter */
+ netif_start_queue(dev); /* allow more packets into adapter */
/* Send page and generate a faked interrupt */
de600_setup_address(transmit_from, TX_ADDR);
de600_put_command(TX_ENABLE);
}
else {
- dev->tbusy = !free_tx_pages;
+ if (free_tx_pages)
+ netif_start_queue(dev);
+ else
+ netif_stop_queue(dev);
select_prn();
}

- sti(); /* interrupts back on */
+ restore_flags(flags);

#ifdef FAKE_SMALL_MAX
/* This will "patch" the socket TCP proto at an early moment */
@@ -489,12 +492,11 @@
int boguscount = 0;

/* This might just as well be deleted now, no crummy drivers present :-) */
- if ((dev == NULL) || (dev->start == 0) || (DE600_IRQ != irq)) {
+ if ((dev == NULL) || (DE600_IRQ != irq)) {
printk("%s: bogus interrupt %d\n", dev?dev->name:"DE-600", irq);
return;
}

- dev->interrupt = 1;
select_nic();
irq_status = de600_read_status(dev);

@@ -521,13 +523,11 @@
*/

/* Enable adapter interrupts */
- dev->interrupt = 0;
select_prn();

if (retrig)
trigger_interrupt(dev);

- sti();
return;
}

@@ -549,7 +549,7 @@
tx_fifo_out = (tx_fifo_out + 1) % TX_PAGES;
++free_tx_pages;
((struct net_device_stats *)(dev->priv))->tx_packets++;
- dev->tbusy = 0;
+ netif_wake_queue(dev);
}

/* More to send, or resend last packet? */
@@ -571,12 +571,15 @@
de600_rx_intr(struct net_device *dev)
{
struct sk_buff *skb;
+ unsiged long flags;
int i;
int read_from;
int size;
register unsigned char *buffer;

+ save_flags(flags);
cli();
+
/* Get size of received packet */
size = de600_read_byte(RX_LEN, dev); /* low byte */
size += (de600_read_byte(RX_LEN, dev) << 8); /* high byte */
@@ -586,7 +589,8 @@
read_from = rx_page_adr();
next_rx_page();
de600_put_command(RX_ENABLE);
- sti();
+
+ restore_flags(flags);

if ((size < 32) || (size > 1535)) {
printk("%s: Bogus packet size %d.\n", dev->name, size);
@@ -596,7 +600,7 @@
}

skb = dev_alloc_skb(size+2);
- sti();
+ restore_flags(flags);
if (skb == NULL) {
printk("%s: Couldn't allocate a sk_buff of size %d.\n",
dev->name, size);
@@ -738,7 +742,7 @@
de600_close(dev);
#endif /* SHUTDOWN_WHEN_LOST */
was_down = 1;
- dev->tbusy = 1; /* Transmit busy... */
+ netif_stop_queue(dev); /* Transmit busy... */
restore_flags(flags);
return 1; /* failed */
}
@@ -748,8 +752,7 @@
was_down = 0;
}

- dev->tbusy = 0; /* Transmit busy... */
- dev->interrupt = 0;
+ netif_start_queue(dev);
tx_fifo_in = 0;
tx_fifo_out = 0;
free_tx_pages = TX_PAGES;
--- linux-2.3.42/drivers/net/de620.c.org Thu Feb 10 23:49:36 2000
+++ linux-2.3.42/drivers/net/de620.c Fri Feb 11 00:05:56 2000
@@ -447,7 +447,6 @@
if (adapter_init(dev)) {
return 1;
}
- dev->start = 1;
return 0;
}

@@ -464,7 +463,6 @@

free_irq(dev->irq, dev);

- dev->start = 0;
MOD_DEC_USE_COUNT;
return 0;
}
@@ -520,9 +518,12 @@
byte using_txbuf;

using_txbuf = de620_tx_buffs(dev); /* Peek at the adapter */
- dev->tbusy = (using_txbuf == (TXBF0 | TXBF1)); /* Boolean! */
+ if (using_txbuf == (TXBF0 | TXBF1))
+ netif_stop_queue(dev);
+ else
+ netif_start_queue(dev);

- if (dev->tbusy) { /* Do timeouts, to avoid hangs. */
+ if (using_txbuf == (TXBF0 | TXBF1)) { /* Do timeouts, to avoid hangs. */
tickssofar = jiffies - dev->trans_start;

if (tickssofar < 5)
@@ -573,7 +574,10 @@
de620_write_block(dev, buffer, len);

dev->trans_start = jiffies;
- dev->tbusy = (using_txbuf == (TXBF0 | TXBF1)); /* Boolean! */
+ if (using_txbuf == (TXBF0 | TXBF1))
+ netif_stop_queue(dev);
+ else
+ netif_start_queue(dev);

((struct net_device_stats *)(dev->priv))->tx_packets++;

@@ -593,6 +597,7 @@
de620_interrupt(int irq_in, void *dev_id, struct pt_regs *regs)
{
struct net_device *dev = dev_id;
+ unsigned long flags;
byte irq_status;
int bogus_count = 0;
int again = 0;
@@ -603,8 +608,8 @@
return;
}

+ save_flags(flags);
cli();
- dev->interrupt = 1;

/* Read the status register (_not_ the status port) */
irq_status = de620_get_register(dev, R_STS);
@@ -619,10 +624,13 @@
while (again && (++bogus_count < 100));
}

- dev->tbusy = (de620_tx_buffs(dev) == (TXBF0 | TXBF1)); /* Boolean! */
+ if (de620_tx_buffs(dev) == (TXBF0 | TXBF1))
+ netif_stop_queue(dev);
+ else
+ netif_start_queue(dev);
+
+ restore_flags(flags);

- dev->interrupt = 0;
- sti();
return;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:56    [W:0.027 / U:0.388 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site