summaryrefslogtreecommitdiffstats
path: root/drivers/net/3c527.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-09-13 13:24:59 -0400
committerJeff Garzik <jeff@garzik.org>2006-09-13 13:24:59 -0400
commit6aa20a2235535605db6d6d2bd850298b2fe7f31e (patch)
treedf0b855043407b831d57f2f2c271f8aab48444f4 /drivers/net/3c527.c
parent7a291083225af6e22ffaa46b3d91cfc1a1ccaab4 (diff)
downloadlinux-6aa20a2235535605db6d6d2bd850298b2fe7f31e.tar.bz2
drivers/net: Trim trailing whitespace
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/3c527.c')
-rw-r--r--drivers/net/3c527.c526
1 files changed, 263 insertions, 263 deletions
diff --git a/drivers/net/3c527.c b/drivers/net/3c527.c
index 03c0f7176fc9..323b6e510108 100644
--- a/drivers/net/3c527.c
+++ b/drivers/net/3c527.c
@@ -1,7 +1,7 @@
/* 3c527.c: 3Com Etherlink/MC32 driver for Linux 2.4 and 2.6.
*
* (c) Copyright 1998 Red Hat Software Inc
- * Written by Alan Cox.
+ * Written by Alan Cox.
* Further debugging by Carl Drougge.
* Initial SMP support by Felipe W Damasio <felipewd@terra.com.br>
* Heavily modified by Richard Procter <rnp@paradise.net.nz>
@@ -30,12 +30,12 @@ DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE " Richard Procter <rnp@paradise.net.
* The diagram (Figure 1-1) and the POS summary disagree with the
* "Interrupt Level" section in the manual.
*
- * The manual contradicts itself when describing the minimum number
- * buffers in the 'configure lists' command.
- * My card accepts a buffer config of 4/4.
+ * The manual contradicts itself when describing the minimum number
+ * buffers in the 'configure lists' command.
+ * My card accepts a buffer config of 4/4.
*
* Setting the SAV BP bit does not save bad packets, but
- * only enables RX on-card stats collection.
+ * only enables RX on-card stats collection.
*
* The documentation in places seems to miss things. In actual fact
* I've always eventually found everything is documented, it just
@@ -64,16 +64,16 @@ DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE " Richard Procter <rnp@paradise.net.
* received frames exceeding a configurable length are passed
* directly to the higher networking layers without incuring a copy,
* in what amounts to a time/space trade-off.
- *
+ *
* The card also keeps a large amount of statistical information
* on-board. In a perfect world, these could be used safely at no
* cost. However, lacking information to the contrary, processing
* them without races would involve so much extra complexity as to
* make it unworthwhile to do so. In the end, a hybrid SW/HW
- * implementation was made necessary --- see mc32_update_stats().
+ * implementation was made necessary --- see mc32_update_stats().
*
* DOC: Notes
- *
+ *
* It should be possible to use two or more cards, but at this stage
* only by loading two copies of the same module.
*
@@ -132,28 +132,28 @@ static unsigned int mc32_debug = NET_DEBUG;
/* The number of low I/O ports used by the ethercard. */
#define MC32_IO_EXTENT 8
-/* As implemented, values must be a power-of-2 -- 4/8/16/32 */
+/* As implemented, values must be a power-of-2 -- 4/8/16/32 */
#define TX_RING_LEN 32 /* Typically the card supports 37 */
#define RX_RING_LEN 8 /* " " " */
-/* Copy break point, see above for details.
- * Setting to > 1512 effectively disables this feature. */
+/* Copy break point, see above for details.
+ * Setting to > 1512 effectively disables this feature. */
#define RX_COPYBREAK 200 /* Value from 3c59x.c */
/* Issue the 82586 workaround command - this is for "busy lans", but
- * basically means for all lans now days - has a performance (latency)
- * cost, but best set. */
+ * basically means for all lans now days - has a performance (latency)
+ * cost, but best set. */
static const int WORKAROUND_82586=1;
/* Pointers to buffers and their on-card records */
-struct mc32_ring_desc
+struct mc32_ring_desc
{
- volatile struct skb_header *p;
- struct sk_buff *skb;
+ volatile struct skb_header *p;
+ struct sk_buff *skb;
};
/* Information that needs to be kept for each board. */
-struct mc32_local
+struct mc32_local
{
int slot;
@@ -165,7 +165,7 @@ struct mc32_local
volatile struct mc32_stats *stats; /* Start of on-card statistics */
u16 tx_chain; /* Transmit list start offset */
u16 rx_chain; /* Receive list start offset */
- u16 tx_len; /* Transmit list count */
+ u16 tx_len; /* Transmit list count */
u16 rx_len; /* Receive list count */
u16 xceiver_desired_state; /* HALTED or RUNNING */
@@ -180,7 +180,7 @@ struct mc32_local
atomic_t tx_ring_head; /* index to tx en-queue end */
u16 tx_ring_tail; /* index to tx de-queue end */
- u16 rx_ring_tail; /* index to rx de-queue end */
+ u16 rx_ring_tail; /* index to rx de-queue end */
struct semaphore cmd_mutex; /* Serialises issuing of execute commands */
struct completion execution_cmd; /* Card has completed an execute command */
@@ -204,7 +204,7 @@ static const struct mca_adapters_t mc32_adapters[] = {
};
-/* Macros for ring index manipulations */
+/* Macros for ring index manipulations */
static inline u16 next_rx(u16 rx) { return (rx+1)&(RX_RING_LEN-1); };
static inline u16 prev_rx(u16 rx) { return (rx-1)&(RX_RING_LEN-1); };
@@ -259,21 +259,21 @@ struct net_device *__init mc32_probe(int unit)
SET_MODULE_OWNER(dev);
- /* Do not check any supplied i/o locations.
+ /* Do not check any supplied i/o locations.
POS registers usually don't fail :) */
- /* MCA cards have POS registers.
- Autodetecting MCA cards is extremely simple.
+ /* MCA cards have POS registers.
+ Autodetecting MCA cards is extremely simple.
Just search for the card. */
for(i = 0; (mc32_adapters[i].name != NULL); i++) {
- current_mca_slot =
+ current_mca_slot =
mca_find_unused_adapter(mc32_adapters[i].id, 0);
if(current_mca_slot != MCA_NOTFOUND) {
if(!mc32_probe1(dev, current_mca_slot))
{
- mca_set_adapter_name(current_mca_slot,
+ mca_set_adapter_name(current_mca_slot,
mc32_adapters[i].name);
mca_mark_as_used(current_mca_slot);
err = register_netdev(dev);
@@ -284,7 +284,7 @@ struct net_device *__init mc32_probe(int unit)
}
return dev;
}
-
+
}
}
free_netdev(dev);
@@ -298,7 +298,7 @@ struct net_device *__init mc32_probe(int unit)
*
* Decode the slot data and configure the card structures. Having done this we
* can reset the card and configure it. The card does a full self test cycle
- * in firmware so we have to wait for it to return and post us either a
+ * in firmware so we have to wait for it to return and post us either a
* failure case or some addresses we use to find the board internals.
*/
@@ -347,7 +347,7 @@ static int __init mc32_probe1(struct net_device *dev, int slot)
printk(KERN_INFO "%s: %s found in slot %d:", dev->name, cardname, slot);
POS = mca_read_stored_pos(slot, 2);
-
+
if(!(POS&1))
{
printk(" disabled.\n");
@@ -357,7 +357,7 @@ static int __init mc32_probe1(struct net_device *dev, int slot)
/* Fill in the 'dev' fields. */
dev->base_addr = mca_io_bases[(POS>>1)&7];
dev->mem_start = mca_mem_bases[(POS>>4)&7];
-
+
POS = mca_read_stored_pos(slot, 4);
if(!(POS&1))
{
@@ -366,21 +366,21 @@ static int __init mc32_probe1(struct net_device *dev, int slot)
}
POS = mca_read_stored_pos(slot, 5);
-
+
i=(POS>>4)&3;
if(i==3)
{
printk("invalid memory window.\n");
return -ENODEV;
}
-
+
i*=16384;
i+=16384;
-
+
dev->mem_end=dev->mem_start + i;
-
+
dev->irq = ((POS>>2)&3)+9;
-
+
if(!request_region(dev->base_addr, MC32_IO_EXTENT, cardname))
{
printk("io 0x%3lX, which is busy.\n", dev->base_addr);
@@ -389,23 +389,23 @@ static int __init mc32_probe1(struct net_device *dev, int slot)
printk("io 0x%3lX irq %d mem 0x%lX (%dK)\n",
dev->base_addr, dev->irq, dev->mem_start, i/1024);
-
-
+
+
/* We ought to set the cache line size here.. */
-
-
+
+
/*
* Go PROM browsing
*/
-
+
printk("%s: Address ", dev->name);
-
+
/* Retrieve and print the ethernet address. */
for (i = 0; i < 6; i++)
{
mca_write_pos(slot, 6, i+12);
mca_write_pos(slot, 7, 0);
-
+
printk(" %2.2x", dev->dev_addr[i] = mca_read_pos(slot,3));
}
@@ -413,12 +413,12 @@ static int __init mc32_probe1(struct net_device *dev, int slot)
mca_write_pos(slot, 7, 0);
POS = mca_read_stored_pos(slot, 4);
-
+
if(POS&2)
printk(" : BNC port selected.\n");
- else
+ else
printk(" : AUI port selected.\n");
-
+
POS=inb(dev->base_addr+HOST_CTRL);
POS|=HOST_CTRL_ATTN|HOST_CTRL_RESET;
POS&=~HOST_CTRL_INTE;
@@ -428,9 +428,9 @@ static int __init mc32_probe1(struct net_device *dev, int slot)
/* Reset off */
POS&=~(HOST_CTRL_ATTN|HOST_CTRL_RESET);
outb(POS, dev->base_addr+HOST_CTRL);
-
+
udelay(300);
-
+
/*
* Grab the IRQ
*/
@@ -448,14 +448,14 @@ static int __init mc32_probe1(struct net_device *dev, int slot)
i=0;
base = inb(dev->base_addr);
-
+
while(base == 0xFF)
{
i++;
if(i == 1000)
{
printk(KERN_ERR "%s: failed to boot adapter.\n", dev->name);
- err = -ENODEV;
+ err = -ENODEV;
goto err_exit_irq;
}
udelay(1000);
@@ -470,15 +470,15 @@ static int __init mc32_probe1(struct net_device *dev, int slot)
base<0x0A?" test failure":"");
else
printk(KERN_ERR "%s: unknown failure %d.\n", dev->name, base);
- err = -ENODEV;
+ err = -ENODEV;
goto err_exit_irq;
}
-
+
base=0;
for(i=0;i<4;i++)
{
int n=0;
-
+
while(!(inb(dev->base_addr+2)&(1<<5)))
{
n++;
@@ -493,31 +493,31 @@ static int __init mc32_probe1(struct net_device *dev, int slot)
base|=(inb(dev->base_addr)<<(8*i));
}
-
+
lp->exec_box=isa_bus_to_virt(dev->mem_start+base);
-
- base=lp->exec_box->data[1]<<16|lp->exec_box->data[0];
-
+
+ base=lp->exec_box->data[1]<<16|lp->exec_box->data[0];
+
lp->base = dev->mem_start+base;
-
- lp->rx_box=isa_bus_to_virt(lp->base + lp->exec_box->data[2]);
+
+ lp->rx_box=isa_bus_to_virt(lp->base + lp->exec_box->data[2]);
lp->tx_box=isa_bus_to_virt(lp->base + lp->exec_box->data[3]);
-
+
lp->stats = isa_bus_to_virt(lp->base + lp->exec_box->data[5]);
/*
* Descriptor chains (card relative)
*/
-
+
lp->tx_chain = lp->exec_box->data[8]; /* Transmit list start offset */
lp->rx_chain = lp->exec_box->data[10]; /* Receive list start offset */
- lp->tx_len = lp->exec_box->data[9]; /* Transmit list count */
+ lp->tx_len = lp->exec_box->data[9]; /* Transmit list count */
lp->rx_len = lp->exec_box->data[11]; /* Receive list count */
init_MUTEX_LOCKED(&lp->cmd_mutex);
init_completion(&lp->execution_cmd);
init_completion(&lp->xceiver_cmd);
-
+
printk("%s: Firmware Rev %d. %d RX buffers, %d TX buffers. Base of 0x%08X.\n",
dev->name, lp->exec_box->data[12], lp->rx_len, lp->tx_len, lp->base);
@@ -543,12 +543,12 @@ err_exit_ports:
/**
* mc32_ready_poll - wait until we can feed it a command
* @dev: The device to wait for
- *
+ *
* Wait until the card becomes ready to accept a command via the
* command register. This tells us nothing about the completion
* status of any pending commands and takes very little time at all.
*/
-
+
static inline void mc32_ready_poll(struct net_device *dev)
{
int ioaddr = dev->base_addr;
@@ -608,22 +608,22 @@ static int mc32_command_nowait(struct net_device *dev, u16 cmd, void *data, int
*
* Sends exec commands in a user context. This permits us to wait around
* for the replies and also to wait for the command buffer to complete
- * from a previous command before we execute our command. After our
+ * from a previous command before we execute our command. After our
* command completes we will attempt any pending multicast reload
* we blocked off by hogging the exec buffer.
*
- * You feed the card a command, you wait, it interrupts you get a
+ * You feed the card a command, you wait, it interrupts you get a
* reply. All well and good. The complication arises because you use
* commands for filter list changes which come in at bh level from things
* like IPV6 group stuff.
*/
-
+
static int mc32_command(struct net_device *dev, u16 cmd, void *data, int len)
{
struct mc32_local *lp = netdev_priv(dev);
int ioaddr = dev->base_addr;
int ret = 0;
-
+
down(&lp->cmd_mutex);
/*
@@ -640,7 +640,7 @@ static int mc32_command(struct net_device *dev, u16 cmd, void *data, int len)
outb(1<<6, ioaddr+HOST_CMD);
wait_for_completion(&lp->execution_cmd);
-
+
if(lp->exec_box->mbox&(1<<13))
ret = -1;
@@ -664,8 +664,8 @@ static int mc32_command(struct net_device *dev, u16 cmd, void *data, int len)
* @dev: The 3c527 card to issue the command to
*
* This may be called from the interrupt state, where it is used
- * to restart the rx ring if the card runs out of rx buffers.
- *
+ * to restart the rx ring if the card runs out of rx buffers.
+ *
* We must first check if it's ok to (re)start the transceiver. See
* mc32_close for details.
*/
@@ -675,21 +675,21 @@ static void mc32_start_transceiver(struct net_device *dev) {
struct mc32_local *lp = netdev_priv(dev);
int ioaddr = dev->base_addr;
- /* Ignore RX overflow on device closure */
+ /* Ignore RX overflow on device closure */
if (lp->xceiver_desired_state==HALTED)
- return;
+ return;
/* Give the card the offset to the post-EOL-bit RX descriptor */
- mc32_ready_poll(dev);
+ mc32_ready_poll(dev);
lp->rx_box->mbox=0;
- lp->rx_box->data[0]=lp->rx_ring[prev_rx(lp->rx_ring_tail)].p->next;
- outb(HOST_CMD_START_RX, ioaddr+HOST_CMD);
+ lp->rx_box->data[0]=lp->rx_ring[prev_rx(lp->rx_ring_tail)].p->next;
+ outb(HOST_CMD_START_RX, ioaddr+HOST_CMD);
- mc32_ready_poll(dev);
+ mc32_ready_poll(dev);
lp->tx_box->mbox=0;
- outb(HOST_CMD_RESTRT_TX, ioaddr+HOST_CMD); /* card ignores this on RX restart */
-
- /* We are not interrupted on start completion */
+ outb(HOST_CMD_RESTRT_TX, ioaddr+HOST_CMD); /* card ignores this on RX restart */
+
+ /* We are not interrupted on start completion */
}
@@ -703,21 +703,21 @@ static void mc32_start_transceiver(struct net_device *dev) {
*
* We then sleep until the card has notified us that both rx and
* tx have been suspended.
- */
+ */
-static void mc32_halt_transceiver(struct net_device *dev)
+static void mc32_halt_transceiver(struct net_device *dev)
{
struct mc32_local *lp = netdev_priv(dev);
int ioaddr = dev->base_addr;
- mc32_ready_poll(dev);
+ mc32_ready_poll(dev);
lp->rx_box->mbox=0;
- outb(HOST_CMD_SUSPND_RX, ioaddr+HOST_CMD);
+ outb(HOST_CMD_SUSPND_RX, ioaddr+HOST_CMD);
wait_for_completion(&lp->xceiver_cmd);
- mc32_ready_poll(dev);
+ mc32_ready_poll(dev);
lp->tx_box->mbox=0;
- outb(HOST_CMD_SUSPND_TX, ioaddr+HOST_CMD);
+ outb(HOST_CMD_SUSPND_TX, ioaddr+HOST_CMD);
wait_for_completion(&lp->xceiver_cmd);
}
@@ -741,14 +741,14 @@ static void mc32_halt_transceiver(struct net_device *dev)
* We then set the end-of-list bit for the last entry so that the
* card will know when it has run out of buffers.
*/
-
+
static int mc32_load_rx_ring(struct net_device *dev)
{
struct mc32_local *lp = netdev_priv(dev);
int i;
u16 rx_base;
volatile struct skb_header *p;
-
+
rx_base=lp->rx_chain;
for(i=0; i<RX_RING_LEN; i++) {
@@ -761,14 +761,14 @@ static int mc32_load_rx_ring(struct net_device *dev)
skb_reserve(lp->rx_ring[i].skb, 18);
p=isa_bus_to_virt(lp->base+rx_base);
-
+
p->control=0;
p->data=isa_virt_to_bus(lp->rx_ring[i].skb->data);
p->status=0;
p->length=1532;
-
- lp->rx_ring[i].p=p;
- rx_base=p->next;
+
+ lp->rx_ring[i].p=p;
+ rx_base=p->next;
}
lp->rx_ring[i-1].p->control |= CONTROL_EOL;
@@ -776,14 +776,14 @@ static int mc32_load_rx_ring(struct net_device *dev)
lp->rx_ring_tail=0;
return 0;
-}
+}
/**
* mc32_flush_rx_ring - free the ring of receive buffers
* @lp: Local data of 3c527 to flush the rx ring of
*
- * Free the buffer for each ring slot. This may be called
+ * Free the buffer for each ring slot. This may be called
* before mc32_load_rx_ring(), eg. on error in mc32_open().
* Requires rx skb pointers to point to a valid skb, or NULL.
*/
@@ -791,16 +791,16 @@ static int mc32_load_rx_ring(struct net_device *dev)
static void mc32_flush_rx_ring(struct net_device *dev)
{
struct mc32_local *lp = netdev_priv(dev);
- int i;
+ int i;
- for(i=0; i < RX_RING_LEN; i++)
- {
+ for(i=0; i < RX_RING_LEN; i++)
+ {
if (lp->rx_ring[i].skb) {
dev_kfree_skb(lp->rx_ring[i].skb);
lp->rx_ring[i].skb = NULL;
}
- lp->rx_ring[i].p=NULL;
- }
+ lp->rx_ring[i].p=NULL;
+ }
}
@@ -808,31 +808,31 @@ static void mc32_flush_rx_ring(struct net_device *dev)
* mc32_load_tx_ring - load transmit ring
* @dev: The 3c527 card to issue the command to
*
- * This sets up the host transmit data-structures.
+ * This sets up the host transmit data-structures.
*
* First, we obtain from the card it's current postion in the tx
* ring, so that we will know where to begin transmitting
* packets.
- *
+ *
* Then, we read the 'next' pointers from the on-card tx ring into
* our tx_ring array to reduce slow shared-mem reads. Finally, we
* intitalise the tx house keeping variables.
- *
- */
+ *
+ */
static void mc32_load_tx_ring(struct net_device *dev)
-{
+{
struct mc32_local *lp = netdev_priv(dev);
volatile struct skb_header *p;
- int i;
+ int i;
u16 tx_base;
- tx_base=lp->tx_box->data[0];
+ tx_base=lp->tx_box->data[0];
for(i=0 ; i<TX_RING_LEN ; i++)
{
p=isa_bus_to_virt(lp->base+tx_base);
- lp->tx_ring[i].p=p;
+ lp->tx_ring[i].p=p;
lp->tx_ring[i].skb=NULL;
tx_base=p->next;
@@ -841,10 +841,10 @@ static void mc32_load_tx_ring(struct net_device *dev)
/* -1 so that tx_ring_head cannot "lap" tx_ring_tail */
/* see mc32_tx_ring */
- atomic_set(&lp->tx_count, TX_RING_LEN-1);
- atomic_set(&lp->tx_ring_head, 0);
- lp->tx_ring_tail=0;
-}
+ atomic_set(&lp->tx_count, TX_RING_LEN-1);
+ atomic_set(&lp->tx_ring_head, 0);
+ lp->tx_ring_tail=0;
+}
/**
@@ -871,11 +871,11 @@ static void mc32_flush_tx_ring(struct net_device *dev)
}
}
- atomic_set(&lp->tx_count, 0);
- atomic_set(&lp->tx_ring_head, 0);
+ atomic_set(&lp->tx_count, 0);
+ atomic_set(&lp->tx_ring_head, 0);
lp->tx_ring_tail=0;
}
-
+
/**
* mc32_open - handle 'up' of card
@@ -909,7 +909,7 @@ static int mc32_open(struct net_device *dev)
regs=inb(ioaddr+HOST_CTRL);
regs|=HOST_CTRL_INTE;
outb(regs, ioaddr+HOST_CTRL);
-
+
/*
* Allow ourselves to issue commands
*/
@@ -924,52 +924,52 @@ static int mc32_open(struct net_device *dev)
mc32_command(dev, 4, &one, 2);
/*
- * Poke it to make sure it's really dead.
+ * Poke it to make sure it's really dead.
*/
- mc32_halt_transceiver(dev);
- mc32_flush_tx_ring(dev);
+ mc32_halt_transceiver(dev);
+ mc32_flush_tx_ring(dev);
- /*
- * Ask card to set up on-card descriptors to our spec
- */
+ /*
+ * Ask card to set up on-card descriptors to our spec
+ */
- if(mc32_command(dev, 8, descnumbuffs, 4)) {
+ if(mc32_command(dev, 8, descnumbuffs, 4)) {
printk("%s: %s rejected our buffer configuration!\n",
dev->name, cardname);
- mc32_close(dev);
- return -ENOBUFS;
+ mc32_close(dev);
+ return -ENOBUFS;
}
-
- /* Report new configuration */
- mc32_command(dev, 6, NULL, 0);
+
+ /* Report new configuration */
+ mc32_command(dev, 6, NULL, 0);
lp->tx_chain = lp->exec_box->data[8]; /* Transmit list start offset */
lp->rx_chain = lp->exec_box->data[10]; /* Receive list start offset */
- lp->tx_len = lp->exec_box->data[9]; /* Transmit list count */
+ lp->tx_len = lp->exec_box->data[9]; /* Transmit list count */
lp->rx_len = lp->exec_box->data[11]; /* Receive list count */
-
+
/* Set Network Address */
mc32_command(dev, 1, dev->dev_addr, 6);
-
+
/* Set the filters */
mc32_set_multicast_list(dev);
-
- if (WORKAROUND_82586) {
+
+ if (WORKAROUND_82586) {
u16 zero_word=0;
mc32_command(dev, 0x0D, &zero_word, 2); /* 82586 bug workaround on */
}
mc32_load_tx_ring(dev);
-
- if(mc32_load_rx_ring(dev))
+
+ if(mc32_load_rx_ring(dev))
{
mc32_close(dev);
return -ENOBUFS;
}
lp->xceiver_desired_state = RUNNING;
-
+
/* And finally, set the ball rolling... */
mc32_start_transceiver(dev);
@@ -1015,14 +1015,14 @@ static void mc32_timeout(struct net_device *dev)
* after we've established a valid packet on the tx ring (and
* before we let the card "see" it, to prevent it racing with the
* irq handler).
- *
+ *
*/
static int mc32_send_packet(struct sk_buff *skb, struct net_device *dev)
{
struct mc32_local *lp = netdev_priv(dev);
u32 head = atomic_read(&lp->tx_ring_head);
-
+
volatile struct skb_header *p, *np;
netif_stop_queue(dev);
@@ -1036,31 +1036,31 @@ static int mc32_send_packet(struct sk_buff *skb, struct net_device *dev)
return 0;
}
- atomic_dec(&lp->tx_count);
+ atomic_dec(&lp->tx_count);
/* P is the last sending/sent buffer as a pointer */
p=lp->tx_ring[head].p;
-
+
head = next_tx(head);
/* NP is the buffer we will be loading */
- np=lp->tx_ring[head].p;
-
+ np=lp->tx_ring[head].p;
+
/* We will need this to flush the buffer out */
lp->tx_ring[head].skb=skb;
- np->length = unlikely(skb->len < ETH_ZLEN) ? ETH_ZLEN : skb->len;
+ np->length = unlikely(skb->len < ETH_ZLEN) ? ETH_ZLEN : skb->len;
np->data = isa_virt_to_bus(skb->data);
np->status = 0;
- np->control = CONTROL_EOP | CONTROL_EOL;
+ np->control = CONTROL_EOP | CONTROL_EOL;
wmb();
-
+
/*
* The new frame has been setup; we can now
* let the interrupt handler and card "see" it
*/
- atomic_set(&lp->tx_ring_head, head);
+ atomic_set(&lp->tx_ring_head, head);
p->control &= ~CONTROL_EOL;
netif_wake_queue(dev);
@@ -1072,13 +1072,13 @@ static int mc32_send_packet(struct sk_buff *skb, struct net_device *dev)
* mc32_update_stats - pull off the on board statistics
* @dev: 3c527 to service
*
- *
+ *
* Query and reset the on-card stats. There's the small possibility
* of a race here, which would result in an underestimation of
* actual errors. As such, we'd prefer to keep all our stats
* collection in software. As a rule, we do. However it can't be
* used for rx errors and collisions as, by default, the card discards
- * bad rx packets.
+ * bad rx packets.
*
* Setting the SAV BP in the rx filter command supposedly
* stops this behaviour. However, testing shows that it only seems to
@@ -1090,30 +1090,30 @@ static int mc32_send_packet(struct sk_buff *skb, struct net_device *dev)
static void mc32_update_stats(struct net_device *dev)
{
struct mc32_local *lp = netdev_priv(dev);
- volatile struct mc32_stats *st = lp->stats;
+ volatile struct mc32_stats *st = lp->stats;
- u32 rx_errors=0;
-
- rx_errors+=lp->net_stats.rx_crc_errors +=st->rx_crc_errors;
+ u32 rx_errors=0;
+
+ rx_errors+=lp->net_stats.rx_crc_errors +=st->rx_crc_errors;
st->rx_crc_errors=0;
- rx_errors+=lp->net_stats.rx_fifo_errors +=st->rx_overrun_errors;
- st->rx_overrun_errors=0;
- rx_errors+=lp->net_stats.rx_frame_errors +=st->rx_alignment_errors;
+ rx_errors+=lp->net_stats.rx_fifo_errors +=st->rx_overrun_errors;
+ st->rx_overrun_errors=0;
+ rx_errors+=lp->net_stats.rx_frame_errors +=st->rx_alignment_errors;
st->rx_alignment_errors=0;
- rx_errors+=lp->net_stats.rx_length_errors+=st->rx_tooshort_errors;
+ rx_errors+=lp->net_stats.rx_length_errors+=st->rx_tooshort_errors;
st->rx_tooshort_errors=0;
rx_errors+=lp->net_stats.rx_missed_errors+=st->rx_outofresource_errors;
- st->rx_outofresource_errors=0;
- lp->net_stats.rx_errors=rx_errors;
-
+ st->rx_outofresource_errors=0;
+ lp->net_stats.rx_errors=rx_errors;
+
/* Number of packets which saw one collision */
lp->net_stats.collisions+=st->dataC[10];
- st->dataC[10]=0;
+ st->dataC[10]=0;
- /* Number of packets which saw 2--15 collisions */
- lp->net_stats.collisions+=st->dataC[11];
- st->dataC[11]=0;
-}
+ /* Number of packets which saw 2--15 collisions */
+ lp->net_stats.collisions+=st->dataC[11];
+ st->dataC[11]=0;
+}
/**
@@ -1130,7 +1130,7 @@ static void mc32_update_stats(struct net_device *dev)
* For each completed packet, we will either copy it and pass it up
* the stack or, if the packet is near MTU sized, we allocate
* another buffer and flip the old one up the stack.
- *
+ *
* We must succeed in keeping a buffer on the ring. If necessary we
* will toss a received packet rather than lose a ring entry. Once
* the first uncompleted descriptor is found, we move the
@@ -1147,72 +1147,72 @@ static void mc32_rx_ring(struct net_device *dev)
int x=0;
rx_old_tail = rx_ring_tail = lp->rx_ring_tail;
-
+
do
- {
- p=lp->rx_ring[rx_ring_tail].p;
+ {
+ p=lp->rx_ring[rx_ring_tail].p;
- if(!(p->status & (1<<7))) { /* Not COMPLETED */
+ if(!(p->status & (1<<7))) { /* Not COMPLETED */
break;
- }
+ }
if(p->status & (1<<6)) /* COMPLETED_OK */
- {
+ {
u16 length=p->length;
- struct sk_buff *skb;
- struct sk_buff *newskb;
+ struct sk_buff *skb;
+ struct sk_buff *newskb;
/* Try to save time by avoiding a copy on big frames */
- if ((length > RX_COPYBREAK)
- && ((newskb=dev_alloc_skb(1532)) != NULL))
- {
+ if ((length > RX_COPYBREAK)
+ && ((newskb=dev_alloc_skb(1532)) != NULL))
+ {
skb=lp->rx_ring[rx_ring_tail].skb;
skb_put(skb, length);
-
- skb_reserve(newskb,18);
- lp->rx_ring[rx_ring_tail].skb=newskb;
- p->data=isa_virt_to_bus(newskb->data);
- }
- else
+
+ skb_reserve(newskb,18);
+ lp->rx_ring[rx_ring_tail].skb=newskb;
+ p->data=isa_virt_to_bus(newskb->data);
+ }
+ else
{
- skb=dev_alloc_skb(length+2);
+ skb=dev_alloc_skb(length+2);
if(skb==NULL) {
- lp->net_stats.rx_dropped++;
- goto dropped;
+ lp->net_stats.rx_dropped++;
+ goto dropped;
}
skb_reserve(skb,2);
memcpy(skb_put(skb, length),
lp->rx_ring[rx_ring_tail].skb->data, length);
}
-
- skb->protocol=eth_type_trans(skb,dev);
- skb->dev=dev;
+
+ skb->protocol=eth_type_trans(skb,dev);
+ skb->dev=dev;
dev->last_rx = jiffies;
- lp->net_stats.rx_packets++;
- lp->net_stats.rx_bytes += length;
+ lp->net_stats.rx_packets++;
+ lp->net_stats.rx_bytes += length;
netif_rx(skb);
}
dropped:
- p->length = 1532;
+ p->length = 1532;
p->status = 0;
-
- rx_ring_tail=next_rx(rx_ring_tail);
+
+ rx_ring_tail=next_rx(rx_ring_tail);
}
- while(x++<48);
+ while(x++<48);
- /* If there was actually a frame to be processed, place the EOL bit */
- /* at the descriptor prior to the one to be filled next */
+ /* If there was actually a frame to be processed, place the EOL bit */
+ /* at the descriptor prior to the one to be filled next */
- if (rx_ring_tail != rx_old_tail)
- {
- lp->rx_ring[prev_rx(rx_ring_tail)].p->control |= CONTROL_EOL;
- lp->rx_ring[prev_rx(rx_old_tail)].p->control &= ~CONTROL_EOL;
+ if (rx_ring_tail != rx_old_tail)
+ {
+ lp->rx_ring[prev_rx(rx_ring_tail)].p->control |= CONTROL_EOL;
+ lp->rx_ring[prev_rx(rx_old_tail)].p->control &= ~CONTROL_EOL;
- lp->rx_ring_tail=rx_ring_tail;
+ lp->rx_ring_tail=rx_ring_tail;
}
}
@@ -1228,10 +1228,10 @@ static void mc32_rx_ring(struct net_device *dev)
* any errors. This continues until the transmit ring is emptied
* or we reach a descriptor that hasn't yet been processed by the
* card.
- *
+ *
*/
-static void mc32_tx_ring(struct net_device *dev)
+static void mc32_tx_ring(struct net_device *dev)
{
struct mc32_local *lp = netdev_priv(dev);
volatile struct skb_header *np;
@@ -1243,28 +1243,28 @@ static void mc32_tx_ring(struct net_device *dev)
* condition with 'queue full'
*/
- while (lp->tx_ring_tail != atomic_read(&lp->tx_ring_head))
- {
- u16 t;
+ while (lp->tx_ring_tail != atomic_read(&lp->tx_ring_head))
+ {
+ u16 t;
- t=next_tx(lp->tx_ring_tail);
- np=lp->tx_ring[t].p;
+ t=next_tx(lp->tx_ring_tail);
+ np=lp->tx_ring[t].p;
- if(!(np->status & (1<<7)))
+ if(!(np->status & (1<<7)))
{
- /* Not COMPLETED */
- break;
- }
+ /* Not COMPLETED */
+ break;
+ }
lp->net_stats.tx_packets++;
if(!(np->status & (1<<6))) /* Not COMPLETED_OK */
{
- lp->net_stats.tx_errors++;
+ lp->net_stats.tx_errors++;
switch(np->status&0x0F)
{
case 1:
lp->net_stats.tx_aborted_errors++;
- break; /* Max collisions */
+ break; /* Max collisions */
case 2:
lp->net_stats.tx_fifo_errors++;
break;
@@ -1273,10 +1273,10 @@ static void mc32_tx_ring(struct net_device *dev)
break;
case 4:
lp->net_stats.tx_window_errors++;
- break; /* CTS Lost */
+ break; /* CTS Lost */
case 5:
lp->net_stats.tx_aborted_errors++;
- break; /* Transmit timeout */
+ break; /* Transmit timeout */
}
}
/* Packets are sent in order - this is
@@ -1288,10 +1288,10 @@ static void mc32_tx_ring(struct net_device *dev)
atomic_inc(&lp->tx_count);
netif_wake_queue(dev);
- lp->tx_ring_tail=t;
+ lp->tx_ring_tail=t;
}
-}
+}
/**
@@ -1322,13 +1322,13 @@ static irqreturn_t mc32_interrupt(int irq, void *dev_id, struct pt_regs * regs)
struct mc32_local *lp;
int ioaddr, status, boguscount = 0;
int rx_event = 0;
- int tx_event = 0;
-
+ int tx_event = 0;
+
if (dev == NULL) {
printk(KERN_WARNING "%s: irq %d for unknown device.\n", cardname, irq);
return IRQ_NONE;
}
-
+
ioaddr = dev->base_addr;
lp = netdev_priv(dev);
@@ -1338,19 +1338,19 @@ static irqreturn_t mc32_interrupt(int irq, void *dev_id, struct pt_regs * regs)
{
status=inb(ioaddr+HOST_CMD);
-#ifdef DEBUG_IRQ
+#ifdef DEBUG_IRQ
printk("Status TX%d RX%d EX%d OV%d BC%d\n",
(status&7), (status>>3)&7, (status>>6)&1,
(status>>7)&1, boguscount);
#endif
-
+
switch(status&7)
{
case 0:
break;
case 6: /* TX fail */
case 2: /* TX ok */
- tx_event = 1;
+ tx_event = 1;
break;
case 3: /* Halt */
case 4: /* Abort */
@@ -1365,7 +1365,7 @@ static irqreturn_t mc32_interrupt(int irq, void *dev_id, struct pt_regs * regs)
case 0:
break;
case 2: /* RX */
- rx_event=1;
+ rx_event=1;
break;
case 3: /* Halt */
case 4: /* Abort */
@@ -1375,12 +1375,12 @@ static irqreturn_t mc32_interrupt(int irq, void *dev_id, struct pt_regs * regs)
/* Out of RX buffers stat */
/* Must restart rx */
lp->net_stats.rx_dropped++;
- mc32_rx_ring(dev);
- mc32_start_transceiver(dev);
+ mc32_rx_ring(dev);
+ mc32_start_transceiver(dev);
break;
default:
- printk("%s: strange rx ack %d\n",
- dev->name, status&7);
+ printk("%s: strange rx ack %d\n",
+ dev->name, status&7);
}
status>>=3;
if(status&1)
@@ -1389,10 +1389,10 @@ static irqreturn_t mc32_interrupt(int irq, void *dev_id, struct pt_regs * regs)
* No thread is waiting: we need to tidy
* up ourself.
*/
-
+
if (lp->cmd_nonblocking) {
up(&lp->cmd_mutex);
- if (lp->mc_reload_wait)
+ if (lp->mc_reload_wait)
mc32_reset_multicast_list(dev);
}
else complete(&lp->execution_cmd);
@@ -1401,22 +1401,22 @@ static irqreturn_t mc32_interrupt(int irq, void *dev_id, struct pt_regs * regs)
{
/*
* We get interrupted once per
- * counter that is about to overflow.
+ * counter that is about to overflow.
*/
- mc32_update_stats(dev);
+ mc32_update_stats(dev);
}
}
/*
- * Process the transmit and receive rings
+ * Process the transmit and receive rings
*/
- if(tx_event)
+ if(tx_event)
mc32_tx_ring(dev);
-
- if(rx_event)
+
+ if(rx_event)
mc32_rx_ring(dev);
return IRQ_HANDLED;
@@ -1435,7 +1435,7 @@ static irqreturn_t mc32_interrupt(int irq, void *dev_id, struct pt_regs * regs)
* driver. Otherwise, it is possible that the card may run out
* of receive buffers and restart the transceiver while we're
* trying to close it.
- *
+ *
* We abort any receive and transmits going on and then wait until
* any pending exec commands have completed in other code threads.
* In theory we can't get here while that is true, in practice I am
@@ -1452,7 +1452,7 @@ static int mc32_close(struct net_device *dev)
u8 regs;
u16 one=1;
-
+
lp->xceiver_desired_state = HALTED;
netif_stop_queue(dev);
@@ -1464,22 +1464,22 @@ static int mc32_close(struct net_device *dev)
/* Shut down the transceiver */
- mc32_halt_transceiver(dev);
-
+ mc32_halt_transceiver(dev);
+
/* Ensure we issue no more commands beyond this point */
down(&lp->cmd_mutex);
-
- /* Ok the card is now stopping */
-
+
+ /* Ok the card is now stopping */
+
regs=inb(ioaddr+HOST_CTRL);
regs&=~HOST_CTRL_INTE;
outb(regs, ioaddr+HOST_CTRL);
mc32_flush_rx_ring(dev);
mc32_flush_tx_ring(dev);
-
- mc32_update_stats(dev);
+
+ mc32_update_stats(dev);
return 0;
}
@@ -1490,15 +1490,15 @@ static int mc32_close(struct net_device *dev)
* @dev: The 3c527 card to handle
*
* We've collected all the stats we can in software already. Now
- * it's time to update those kept on-card and return the lot.
- *
+ * it's time to update those kept on-card and return the lot.
+ *
*/
static struct net_device_stats *mc32_get_stats(struct net_device *dev)
{
struct mc32_local *lp = netdev_priv(dev);
-
- mc32_update_stats(dev);
+
+ mc32_update_stats(dev);
return &lp->net_stats;
}
@@ -1506,7 +1506,7 @@ static struct net_device_stats *mc32_get_stats(struct net_device *dev)
/**
* do_mc32_set_multicast_list - attempt to update multicasts
* @dev: 3c527 device to load the list on
- * @retry: indicates this is not the first call.
+ * @retry: indicates this is not the first call.
*
*
* Actually set or clear the multicast filter for this adaptor. The
@@ -1514,22 +1514,22 @@ static struct net_device_stats *mc32_get_stats(struct net_device *dev)
* state as it may take multiple calls to get the command sequence
* completed. We just keep trying to schedule the loads until we
* manage to process them all.
- *
+ *
* num_addrs == -1 Promiscuous mode, receive all packets
- *
+ *
* num_addrs == 0 Normal mode, clear multicast list
- *
- * num_addrs > 0 Multicast mode, receive normal and MC packets,
- * and do best-effort filtering.
*
- * See mc32_update_stats() regards setting the SAV BP bit.
+ * num_addrs > 0 Multicast mode, receive normal and MC packets,
+ * and do best-effort filtering.
+ *
+ * See mc32_update_stats() regards setting the SAV BP bit.
*
*/
static void do_mc32_set_multicast_list(struct net_device *dev, int retry)
{
struct mc32_local *lp = netdev_priv(dev);
- u16 filt = (1<<2); /* Save Bad Packets, for stats purposes */
+ u16 filt = (1<<2); /* Save Bad Packets, for stats purposes */
if (dev->flags&IFF_PROMISC)
/* Enable promiscuous mode */
@@ -1544,9 +1544,9 @@ static void do_mc32_set_multicast_list(struct net_device *dev, int retry)
unsigned char block[62];
unsigned char *bp;
struct dev_mc_list *dmc=dev->mc_list;
-
+
int i;
-
+
if(retry==0)
lp->mc_list_valid = 0;
if(!lp->mc_list_valid)
@@ -1554,7 +1554,7 @@ static void do_mc32_set_multicast_list(struct net_device *dev, int retry)
block[1]=0;
block[0]=dev->mc_count;
bp=block+2;
-
+
for(i=0;i<dev->mc_count;i++)
{
memcpy(bp, dmc->dmi_addr, 6);
@@ -1569,12 +1569,12 @@ static void do_mc32_set_multicast_list(struct net_device *dev, int retry)
lp->mc_list_valid=1;
}
}
-
- if(mc32_command_nowait(dev, 0, &filt, 2)==-1)
+
+ if(mc32_command_nowait(dev, 0, &filt, 2)==-1)
{
lp->mc_reload_wait = 1;
- }
- else {
+ }
+ else {
lp->mc_reload_wait = 0;
}
}