Commit 767b8bf8 authored by Tim Hockin's avatar Tim Hockin Committed by Jeff Garzik

drivers/net/natsemi.c: janitorial - whitespace, wrap, and indenting cleanup

parent 61199b1f
/* natsemi.c: A Linux PCI Ethernet driver for the NatSemi DP8381x series. */
/*
Written/copyright 1999-2001 by Donald Becker.
Portions copyright (c) 2001 Sun Microsystems (thockin@sun.com)
Portions copyright (c) 2001,2002 Sun Microsystems (thockin@sun.com)
Portions copyright 2001,2002 Manfred Spraul (manfred@colorfullife.com)
This software may be used and distributed according to the terms of
the GNU General Public License (GPL), incorporated herein by reference.
......@@ -174,18 +175,6 @@
/* Updated to recommendations in pci-skeleton v2.03. */
/* Automatically extracted configuration info:
probe-func: natsemi_probe
config-in: tristate 'National Semiconductor DP8381x series PCI Ethernet support' CONFIG_NATSEMI
c-help-name: National Semiconductor DP8381x series PCI Ethernet support
c-help-symbol: CONFIG_NATSEMI
c-help: This driver is for the National Semiconductor DP8381x series,
c-help: including the 8381[56] chips.
c-help: More specific information and updates are available from
c-help: http://www.scyld.com/network/natsemi.html
*/
/* The user-configurable values.
These may be modified when a driver module is loaded.*/
......@@ -247,9 +236,11 @@ static int full_duplex[MAX_UNITS];
/* These identify the driver base version and may not be removed. */
static char version[] __devinitdata =
KERN_INFO DRV_NAME ".c:v1.07 1/9/2001 Written by Donald Becker <becker@scyld.com>\n"
KERN_INFO DRV_NAME
".c:v1.07 1/9/2001 Written by Donald Becker <becker@scyld.com>\n"
KERN_INFO " http://www.scyld.com/network/natsemi.html\n"
KERN_INFO " (unofficial 2.4.x kernel port, version " DRV_VERSION ", " DRV_RELDATE " Jeff Garzik, Tjeerd Mulder)\n";
KERN_INFO " (unofficial 2.4.x kernel port, version "
DRV_VERSION ", " DRV_RELDATE " Jeff Garzik, Tjeerd Mulder)\n";
MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
MODULE_DESCRIPTION("National Semiconductor DP8381x series PCI Ethernet driver");
......@@ -261,11 +252,14 @@ MODULE_PARM(debug, "i");
MODULE_PARM(rx_copybreak, "i");
MODULE_PARM(options, "1-" __MODULE_STRING(MAX_UNITS) "i");
MODULE_PARM(full_duplex, "1-" __MODULE_STRING(MAX_UNITS) "i");
MODULE_PARM_DESC(max_interrupt_work, "DP8381x maximum events handled per interrupt");
MODULE_PARM_DESC(max_interrupt_work,
"DP8381x maximum events handled per interrupt");
MODULE_PARM_DESC(mtu, "DP8381x MTU (all boards)");
MODULE_PARM_DESC(debug, "DP8381x default debug bitmask");
MODULE_PARM_DESC(rx_copybreak, "DP8381x copy breakpoint for copy-only-tiny-frames");
MODULE_PARM_DESC(options, "DP8381x: Bits 0-3: media type, bit 17: full duplex");
MODULE_PARM_DESC(rx_copybreak,
"DP8381x copy breakpoint for copy-only-tiny-frames");
MODULE_PARM_DESC(options,
"DP8381x: Bits 0-3: media type, bit 17: full duplex");
MODULE_PARM_DESC(full_duplex, "DP8381x full duplex setting(s) (1)");
/*
......@@ -348,7 +342,7 @@ IVc. Errata
None characterised.
*/
enum pcistuff {
PCI_USES_IO = 0x01,
......@@ -634,32 +628,36 @@ enum desc_status_bits {
};
struct netdev_private {
/* Descriptor rings first for alignment. */
/* Descriptor rings first for alignment */
dma_addr_t ring_dma;
struct netdev_desc* rx_ring;
struct netdev_desc* tx_ring;
/* The addresses of receive-in-place skbuffs. */
struct sk_buff* rx_skbuff[RX_RING_SIZE];
struct netdev_desc *rx_ring;
struct netdev_desc *tx_ring;
/* The addresses of receive-in-place skbuffs */
struct sk_buff *rx_skbuff[RX_RING_SIZE];
dma_addr_t rx_dma[RX_RING_SIZE];
/* The saved address of a sent-in-place packet/buffer, for later free(). */
struct sk_buff* tx_skbuff[TX_RING_SIZE];
/* address of a sent-in-place packet/buffer, for later free() */
struct sk_buff *tx_skbuff[TX_RING_SIZE];
dma_addr_t tx_dma[TX_RING_SIZE];
struct net_device_stats stats;
struct timer_list timer; /* Media monitoring timer. */
/* Frequently used values: keep some adjacent for cache effect. */
/* Media monitoring timer */
struct timer_list timer;
/* Frequently used values: keep some adjacent for cache effect */
struct pci_dev *pci_dev;
struct netdev_desc *rx_head_desc;
unsigned int cur_rx, dirty_rx; /* Producer/consumer ring indices */
/* Producer/consumer ring indices */
unsigned int cur_rx, dirty_rx;
unsigned int cur_tx, dirty_tx;
unsigned int rx_buf_sz; /* Based on MTU+slack. */
/* Based on MTU+slack. */
unsigned int rx_buf_sz;
int oom;
int hands_off; /* Do not touch the nic registers */
/* These values are keep track of the transceiver/media in use. */
/* Do not touch the nic registers */
int hands_off;
/* These values are keep track of the transceiver/media in use */
unsigned int full_duplex;
/* Rx filter. */
/* Rx filter */
u32 cur_rx_mode;
u32 rx_filter[16];
/* FIFO and PCI burst thresholds. */
/* FIFO and PCI burst thresholds */
u32 tx_config, rx_config;
/* original contents of ClkRun register */
u32 SavedClkRun;
......@@ -667,8 +665,8 @@ struct netdev_private {
u32 srr;
/* expected DSPCFG value */
u16 dspcfg;
/* MII transceiver section. */
u16 advertising; /* NWay media advertisement */
/* MII transceiver section */
u16 advertising;
unsigned int iosize;
spinlock_t lock;
u32 msg_enable;
......@@ -715,7 +713,7 @@ static int netdev_close(struct net_device *dev);
static int netdev_get_regs(struct net_device *dev, u8 *buf);
static int netdev_get_eeprom(struct net_device *dev, u8 *buf);
static int __devinit natsemi_probe1 (struct pci_dev *pdev,
const struct pci_device_id *ent)
{
......@@ -857,7 +855,8 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev,
printk(KERN_INFO "%s: Transceiver default autonegotiation %s "
"10%s %s duplex.\n",
dev->name,
chip_config & CfgAnegEnable ? "enabled, advertise" : "disabled, force",
chip_config & CfgAnegEnable ?
"enabled, advertise" : "disabled, force",
chip_config & CfgAneg100 ? "0" : "",
chip_config & CfgAnegFull ? "full" : "half");
}
......@@ -877,7 +876,7 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev,
return 0;
}
/* Read the EEPROM and MII Management Data I/O (MDIO) interfaces.
The EEPROM code is for the common 93c06/46 EEPROMs with 6 bit addresses. */
......@@ -932,8 +931,8 @@ static int eeprom_read(long addr, int location)
}
/* MII transceiver control section.
The 83815 series has an internal transceiver, and we present the
management registers as if they were MII connected. */
* The 83815 series has an internal transceiver, and we present the
* management registers as if they were MII connected. */
static int mdio_read(struct net_device *dev, int phy_id, int reg)
{
......@@ -1030,7 +1029,6 @@ static void natsemi_reset(struct net_device *dev)
}
/* restore RFCR */
writel(rfcr, dev->base_addr + RxFilterAddr);
}
static void natsemi_reload_eeprom(struct net_device *dev)
......@@ -1543,8 +1541,7 @@ static void drain_ring(struct net_device *dev)
np->rx_ring[i].addr = 0xBADF00D0; /* An invalid address. */
if (np->rx_skbuff[i]) {
pci_unmap_single(np->pci_dev,
np->rx_dma[i],
np->rx_skbuff[i]->len,
np->rx_dma[i], np->rx_skbuff[i]->len,
PCI_DMA_FROMDEVICE);
dev_kfree_skb(np->rx_skbuff[i]);
}
......@@ -1647,7 +1644,8 @@ static void netdev_tx_done(struct net_device *dev)
np->stats.tx_packets++;
np->stats.tx_bytes += np->tx_skbuff[entry]->len;
} else { /* Various Tx errors */
int tx_status = le32_to_cpu(np->tx_ring[entry].cmd_status);
int tx_status =
le32_to_cpu(np->tx_ring[entry].cmd_status);
if (tx_status & (DescTxAbort|DescTxExcColl))
np->stats.tx_aborted_errors++;
if (tx_status & DescTxFIFO)
......@@ -1688,8 +1686,10 @@ static void intr_handler(int irq, void *dev_instance, struct pt_regs *rgs)
u32 intr_status = readl(ioaddr + IntrStatus);
if (netif_msg_intr(np))
printk(KERN_DEBUG "%s: Interrupt, status %#08x, mask %#08x.\n",
dev->name, intr_status, readl(ioaddr + IntrMask));
printk(KERN_DEBUG
"%s: Interrupt, status %#08x, mask %#08x.\n",
dev->name, intr_status,
readl(ioaddr + IntrMask));
if (intr_status == 0)
break;
......@@ -1715,7 +1715,8 @@ static void intr_handler(int irq, void *dev_instance, struct pt_regs *rgs)
if (netif_msg_intr(np))
printk(KERN_WARNING
"%s: Too much work at interrupt, "
"status=%#08x.\n", dev->name, intr_status);
"status=%#08x.\n",
dev->name, intr_status);
break;
}
} while (1);
......@@ -1772,16 +1773,19 @@ static void netdev_rx(struct net_device *dev)
if (pkt_len < rx_copybreak
&& (skb = dev_alloc_skb(pkt_len + 2)) != NULL) {
skb->dev = dev;
skb_reserve(skb, 2); /* 16 byte align the IP header */
pci_dma_sync_single(np->pci_dev, np->rx_dma[entry],
/* 16 byte align the IP header */
skb_reserve(skb, 2);
pci_dma_sync_single(np->pci_dev,
np->rx_dma[entry],
np->rx_skbuff[entry]->len,
PCI_DMA_FROMDEVICE);
#if HAS_IP_COPYSUM
eth_copy_and_sum(skb, np->rx_skbuff[entry]->tail, pkt_len, 0);
eth_copy_and_sum(skb,
np->rx_skbuff[entry]->tail, pkt_len, 0);
skb_put(skb, pkt_len);
#else
memcpy(skb_put(skb, pkt_len), np->rx_skbuff[entry]->tail,
pkt_len);
memcpy(skb_put(skb, pkt_len),
np->rx_skbuff[entry]->tail, pkt_len);
#endif
} else {
pci_unmap_single(np->pci_dev, np->rx_dma[entry],
......@@ -1791,7 +1795,6 @@ static void netdev_rx(struct net_device *dev)
np->rx_skbuff[entry] = NULL;
}
skb->protocol = eth_type_trans(skb, dev);
/* W/ hardware checksum: skb->ip_summed = CHECKSUM_UNNECESSARY; */
netif_rx(skb);
dev->last_rx = jiffies;
np->stats.rx_packets++;
......@@ -1950,7 +1953,8 @@ static void __set_rx_mode(struct net_device *dev)
memset(mc_filter, 0, sizeof(mc_filter));
for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count;
i++, mclist = mclist->next) {
set_bit_le(dp83815_crc(ETH_ALEN, mclist->dmi_addr) & 0x1ff,
set_bit_le(
dp83815_crc(ETH_ALEN, mclist->dmi_addr) & 0x1ff,
mc_filter);
}
rx_mode = RxFilterEnable | AcceptBroadcast
......@@ -2566,7 +2570,7 @@ static int netdev_close(struct net_device *dev)
return 0;
}
static void __devexit natsemi_remove1 (struct pci_dev *pdev)
{
struct net_device *dev = pci_get_drvdata(pdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment