lkml.org 
[lkml]   [1998]   [Jun]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subjectdrivers/net/3c509+3c59x patch v2.
Dear Linus,

This is a simple patch to 3c509.c and 3c59x.c drivers that does the
following:

a) removes unnecessary #include <linux/kernel.h> and
<linux/ptrace.h> which are included by <linux/sched.h> anyway.

b) in 3c509 only, removes an extra status = inw() from el3_interrupt()
which is done in a while() loop later on. This saves an I/O cycle on each
interrupt...

c) removes an extra ioaddr parameter from update_stats() because
dev->base_addr contains that information already.

I am not sure whether Donald Becker still maintains 3c509 which is why I
mail this to you directly.

I also noticed that debug variable is not handled in the proper
MODULE_PARM() manner and hence there is no way to change el3_debug at
insmod time so I was going to fix that as well, if Donald/You do not
mind... :)

Regards,
------
Tigran A. Aivazian | http://www.sco.com/
Escalations Research Group | Email: tigran@sco.com
Santa Cruz Operation Ltd |
diff -ur linux/drivers/net/3c509.c linux-2.1.105.new/drivers/net/3c509.c
--- linux/drivers/net/3c509.c Thu May 7 21:40:41 1998
+++ linux-2.1.105.new/drivers/net/3c509.c Thu Jun 11 15:00:26 1998
@@ -47,11 +47,9 @@
#include <linux/module.h>

#include <linux/config.h> /* for CONFIG_MCA */
-#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/string.h>
#include <linux/interrupt.h>
-#include <linux/ptrace.h>
#include <linux/errno.h>
#include <linux/in.h>
#include <linux/malloc.h>
@@ -136,7 +134,7 @@
static int el3_open(struct device *dev);
static int el3_start_xmit(struct sk_buff *skb, struct device *dev);
static void el3_interrupt(int irq, void *dev_id, struct pt_regs *regs);
-static void update_stats(int addr, struct device *dev);
+static void update_stats(struct device *dev);
static struct enet_statistics *el3_get_stats(struct device *dev);
static int el3_rx(struct device *dev);
static int el3_close(struct device *dev);
@@ -533,10 +531,11 @@
dev->interrupt = 1;

ioaddr = dev->base_addr;
- status = inw(ioaddr + EL3_STATUS);

- if (el3_debug > 4)
+ if (el3_debug > 4) {
+ status = inw(ioaddr + EL3_STATUS);
printk("%s: interrupt, status %4.4x.\n", dev->name, status);
+ }

while ((status = inw(ioaddr + EL3_STATUS)) &
(IntLatch | RxComplete | StatsFull)) {
@@ -555,7 +554,7 @@
if (status & (AdapterFailure | RxEarly | StatsFull)) {
/* Handle all uncommon interrupts. */
if (status & StatsFull) /* Empty statistics. */
- update_stats(ioaddr, dev);
+ update_stats(dev);
if (status & RxEarly) { /* Rx early is unused. */
el3_rx(dev);
outw(AckIntr | RxEarly, ioaddr + EL3_CMD);
@@ -580,7 +579,6 @@
outw(AckIntr | 0xFF, ioaddr + EL3_CMD);
break;
}
- /* Acknowledge the IRQ. */
outw(AckIntr | IntReq | IntLatch, ioaddr + EL3_CMD); /* Ack IRQ */
}

@@ -602,7 +600,7 @@

save_flags(flags);
cli();
- update_stats(dev->base_addr, dev);
+ update_stats(dev);
restore_flags(flags);
return &lp->stats;
}
@@ -612,9 +610,10 @@
operation, and it's simpler for the rest of the driver to assume that
window 1 is always valid rather than use a special window-state variable.
*/
-static void update_stats(int ioaddr, struct device *dev)
+static void update_stats(struct device *dev)
{
struct el3_private *lp = (struct el3_private *)dev->priv;
+ int ioaddr = dev->base_addr;

if (el3_debug > 5)
printk(" Updating the statistics.\n");
@@ -760,7 +759,7 @@
/* But we explicitly zero the IRQ line select anyway. */
outw(0x0f00, ioaddr + WN0_IRQ);

- update_stats(ioaddr, dev);
+ update_stats(dev);
MOD_DEC_USE_COUNT;
return 0;
}
diff -ur linux/drivers/net/3c59x.c linux-2.1.105.new/drivers/net/3c59x.c
--- linux/drivers/net/3c59x.c Thu May 21 01:54:51 1998
+++ linux-2.1.105.new/drivers/net/3c59x.c Thu Jun 11 15:08:53 1998
@@ -55,10 +55,8 @@
#define MOD_DEC_USE_COUNT
#endif

-#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/string.h>
-#include <linux/ptrace.h>
#include <linux/errno.h>
#include <linux/in.h>
#include <linux/ioport.h>
@@ -453,7 +451,7 @@
static int boomerang_rx(struct device *dev);
static void vortex_interrupt IRQ(int irq, void *dev_id, struct pt_regs *regs);
static int vortex_close(struct device *dev);
-static void update_stats(int addr, struct device *dev);
+static void update_stats(struct device *dev);
static struct enet_statistics *vortex_get_stats(struct device *dev);
static void set_rx_mode(struct device *dev);
#ifdef HAVE_PRIVATE_IOCTL
@@ -1484,7 +1482,7 @@

status = inw(ioaddr + EL3_STATUS);

- if (vortex_debug > 4)
+ if (vortex_debug > 4)
printk("%s: interrupt, status %4.4x, timer %d.\n", dev->name,
status, latency);
#ifdef notdef
@@ -1574,7 +1572,7 @@
static int DoneDidThat = 0;
if (vortex_debug > 4)
printk("%s: Updating stats.\n", dev->name);
- update_stats(ioaddr, dev);
+ update_stats(dev);
/* DEBUG HACK: Disable statistics as an interrupt source. */
/* This occurs when we have the wrong media type! */
if (DoneDidThat == 0 &&
@@ -1857,7 +1855,7 @@

outw(SetIntrEnb | 0x0000, ioaddr + EL3_CMD);

- update_stats(ioaddr, dev);
+ update_stats(dev);
if (vp->full_bus_master_rx) { /* Free Boomerang bus master Rx buffers. */
outl(0, ioaddr + UpListPtr);
for (i = 0; i < RX_RING_SIZE; i++)
@@ -1892,7 +1890,7 @@
if (dev->start) {
save_flags(flags);
cli();
- update_stats(dev->base_addr, dev);
+ update_stats(dev);
restore_flags(flags);
}
return &vp->stats;
@@ -1905,9 +1903,10 @@
table. This is done by checking that the ASM (!) code generated uses
atomic updates with '+='.
*/
-static void update_stats(int ioaddr, struct device *dev)
+static void update_stats(struct device *dev)
{
struct vortex_private *vp = (struct vortex_private *)dev->priv;
+ int ioaddr = dev->base_addr;

/* Unlike the 3c5x9 we need not turn off stats updates while reading. */
/* Switch to the stats window, and read everything. */
\
 
 \ /
  Last update: 2005-03-22 13:43    [W:0.034 / U:0.600 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site