Commit 5b08b791 authored by Steven Parker's avatar Steven Parker Committed by Tim Hockin

drivers/net/eepro100.c:

* use netif_msg_xxx() instead of speedo_debug
* better default debug mask, proper use of debug module param
* add ETHTOOL_[GS]MSGLVL
parent 69ee28d0
...@@ -65,7 +65,6 @@ static int multicast_filter_limit = 64; ...@@ -65,7 +65,6 @@ static int multicast_filter_limit = 64;
e.g. "options=16" for FD, "options=32" for 100mbps-only. */ e.g. "options=16" for FD, "options=32" for 100mbps-only. */
static int full_duplex[] = {-1, -1, -1, -1, -1, -1, -1, -1}; static int full_duplex[] = {-1, -1, -1, -1, -1, -1, -1, -1};
static int options[] = {-1, -1, -1, -1, -1, -1, -1, -1}; static int options[] = {-1, -1, -1, -1, -1, -1, -1, -1};
static int debug = -1; /* The debug level */
/* A few values that may be tweaked. */ /* A few values that may be tweaked. */
/* The ring sizes should be a power of two for efficiency. */ /* The ring sizes should be a power of two for efficiency. */
...@@ -121,6 +120,15 @@ static int debug = -1; /* The debug level */ ...@@ -121,6 +120,15 @@ static int debug = -1; /* The debug level */
#include <linux/ethtool.h> #include <linux/ethtool.h>
#include <linux/mii.h> #include <linux/mii.h>
static int debug = -1;
#define DEBUG_DEFAULT (NETIF_MSG_DRV | \
NETIF_MSG_IFDOWN | \
NETIF_MSG_IFUP | \
NETIF_MSG_RX_ERR | \
NETIF_MSG_TX_ERR)
#define DEBUG ((debug >= 0) ? (1<<debug)-1 : DEBUG_DEFAULT)
MODULE_AUTHOR("Maintainer: Andrey V. Savochkin <saw@saw.sw.com.sg>"); MODULE_AUTHOR("Maintainer: Andrey V. Savochkin <saw@saw.sw.com.sg>");
MODULE_DESCRIPTION("Intel i82557/i82558/i82559 PCI EtherExpressPro driver"); MODULE_DESCRIPTION("Intel i82557/i82558/i82559 PCI EtherExpressPro driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -168,7 +176,6 @@ static inline int null_set_power_state(struct pci_dev *dev, int state) ...@@ -168,7 +176,6 @@ static inline int null_set_power_state(struct pci_dev *dev, int state)
} while(0) } while(0)
static int speedo_debug = 1;
/* /*
Theory of Operation Theory of Operation
...@@ -496,6 +503,7 @@ struct speedo_private { ...@@ -496,6 +503,7 @@ struct speedo_private {
unsigned short phy[2]; /* PHY media interfaces available. */ unsigned short phy[2]; /* PHY media interfaces available. */
unsigned short partner; /* Link partner caps. */ unsigned short partner; /* Link partner caps. */
struct mii_if_info mii_if; /* MII API hooks, info */ struct mii_if_info mii_if; /* MII API hooks, info */
u32 msg_enable; /* debug message level */
#ifdef CONFIG_PM #ifdef CONFIG_PM
u32 pm_state[16]; u32 pm_state[16];
#endif #endif
...@@ -567,9 +575,12 @@ static int __devinit eepro100_init_one (struct pci_dev *pdev, ...@@ -567,9 +575,12 @@ static int __devinit eepro100_init_one (struct pci_dev *pdev,
int acpi_idle_state = 0, pm; int acpi_idle_state = 0, pm;
static int cards_found /* = 0 */; static int cards_found /* = 0 */;
static int did_version /* = 0 */; /* Already printed version info. */ #ifndef MODULE
if (speedo_debug > 0 && did_version++ == 0) /* when built-in, we only print version if device is found */
static int did_version;
if (did_version++ == 0)
printk(version); printk(version);
#endif
/* save power state before pci_enable_device overwrites it */ /* save power state before pci_enable_device overwrites it */
pm = pci_find_capability(pdev, PCI_CAP_ID_PM); pm = pci_find_capability(pdev, PCI_CAP_ID_PM);
...@@ -598,7 +609,7 @@ static int __devinit eepro100_init_one (struct pci_dev *pdev, ...@@ -598,7 +609,7 @@ static int __devinit eepro100_init_one (struct pci_dev *pdev,
irq = pdev->irq; irq = pdev->irq;
#ifdef USE_IO #ifdef USE_IO
ioaddr = pci_resource_start(pdev, 1); ioaddr = pci_resource_start(pdev, 1);
if (speedo_debug > 2) if (DEBUG & NETIF_MSG_PROBE)
printk("Found Intel i82557 PCI Speedo at I/O %#lx, IRQ %d.\n", printk("Found Intel i82557 PCI Speedo at I/O %#lx, IRQ %d.\n",
ioaddr, irq); ioaddr, irq);
#else #else
...@@ -609,7 +620,7 @@ static int __devinit eepro100_init_one (struct pci_dev *pdev, ...@@ -609,7 +620,7 @@ static int __devinit eepro100_init_one (struct pci_dev *pdev,
pci_resource_len(pdev, 0), pci_resource_start(pdev, 0)); pci_resource_len(pdev, 0), pci_resource_start(pdev, 0));
goto err_out_free_mmio_region; goto err_out_free_mmio_region;
} }
if (speedo_debug > 2) if (DEBUG & NETIF_MSG_PROBE)
printk("Found Intel i82557 PCI Speedo, MMIO at %#lx, IRQ %d.\n", printk("Found Intel i82557 PCI Speedo, MMIO at %#lx, IRQ %d.\n",
pci_resource_start(pdev, 0), irq); pci_resource_start(pdev, 0), irq);
#endif #endif
...@@ -815,6 +826,7 @@ static int __devinit speedo_found1(struct pci_dev *pdev, ...@@ -815,6 +826,7 @@ static int __devinit speedo_found1(struct pci_dev *pdev,
sp = dev->priv; sp = dev->priv;
sp->pdev = pdev; sp->pdev = pdev;
sp->msg_enable = DEBUG;
sp->acpi_pwr = acpi_idle_state; sp->acpi_pwr = acpi_idle_state;
sp->tx_ring = tx_ring_space; sp->tx_ring = tx_ring_space;
sp->tx_ring_dma = tx_ring_dma; sp->tx_ring_dma = tx_ring_dma;
...@@ -960,7 +972,7 @@ speedo_open(struct net_device *dev) ...@@ -960,7 +972,7 @@ speedo_open(struct net_device *dev)
long ioaddr = dev->base_addr; long ioaddr = dev->base_addr;
int retval; int retval;
if (speedo_debug > 1) if (netif_msg_ifup(sp))
printk(KERN_DEBUG "%s: speedo_open() irq %d.\n", dev->name, dev->irq); printk(KERN_DEBUG "%s: speedo_open() irq %d.\n", dev->name, dev->irq);
pci_set_power_state(sp->pdev, 0); pci_set_power_state(sp->pdev, 0);
...@@ -1019,7 +1031,7 @@ speedo_open(struct net_device *dev) ...@@ -1019,7 +1031,7 @@ speedo_open(struct net_device *dev)
mii_check_link(&sp->mii_if); mii_check_link(&sp->mii_if);
if (speedo_debug > 2) { if (netif_msg_ifup(sp)) {
printk(KERN_DEBUG "%s: Done speedo_open(), status %8.8x.\n", printk(KERN_DEBUG "%s: Done speedo_open(), status %8.8x.\n",
dev->name, inw(ioaddr + SCBStatus)); dev->name, inw(ioaddr + SCBStatus));
} }
...@@ -1074,7 +1086,7 @@ static void speedo_resume(struct net_device *dev) ...@@ -1074,7 +1086,7 @@ static void speedo_resume(struct net_device *dev)
wait_for_cmd_done(ioaddr + SCBCmd); wait_for_cmd_done(ioaddr + SCBCmd);
if (sp->rx_ringp[sp->cur_rx % RX_RING_SIZE] == NULL) { if (sp->rx_ringp[sp->cur_rx % RX_RING_SIZE] == NULL) {
if (speedo_debug > 2) if (netif_msg_rx_err(sp))
printk(KERN_DEBUG "%s: NULL cur_rx in speedo_resume().\n", printk(KERN_DEBUG "%s: NULL cur_rx in speedo_resume().\n",
dev->name); dev->name);
} else { } else {
...@@ -1169,7 +1181,7 @@ static void speedo_timer(unsigned long data) ...@@ -1169,7 +1181,7 @@ static void speedo_timer(unsigned long data)
int partner = mdio_read(dev, phy_num, MII_LPA); int partner = mdio_read(dev, phy_num, MII_LPA);
if (partner != sp->partner) { if (partner != sp->partner) {
int flow_ctrl = sp->mii_if.advertising & partner & 0x0400 ? 1 : 0; int flow_ctrl = sp->mii_if.advertising & partner & 0x0400 ? 1 : 0;
if (speedo_debug > 2) { if (netif_msg_link(sp)) {
printk(KERN_DEBUG "%s: Link status change.\n", dev->name); printk(KERN_DEBUG "%s: Link status change.\n", dev->name);
printk(KERN_DEBUG "%s: Old partner %x, new %x, adv %x.\n", printk(KERN_DEBUG "%s: Old partner %x, new %x, adv %x.\n",
dev->name, sp->partner, partner, sp->mii_if.advertising); dev->name, sp->partner, partner, sp->mii_if.advertising);
...@@ -1182,7 +1194,7 @@ static void speedo_timer(unsigned long data) ...@@ -1182,7 +1194,7 @@ static void speedo_timer(unsigned long data)
} }
} }
mii_check_link(&sp->mii_if); mii_check_link(&sp->mii_if);
if (speedo_debug > 3) { if (netif_msg_timer(sp)) {
printk(KERN_DEBUG "%s: Media control tick, status %4.4x.\n", printk(KERN_DEBUG "%s: Media control tick, status %4.4x.\n",
dev->name, inw(ioaddr + SCBStatus)); dev->name, inw(ioaddr + SCBStatus));
} }
...@@ -1191,7 +1203,7 @@ static void speedo_timer(unsigned long data) ...@@ -1191,7 +1203,7 @@ static void speedo_timer(unsigned long data)
/* We haven't received a packet in a Long Time. We might have been /* We haven't received a packet in a Long Time. We might have been
bitten by the receiver hang bug. This can be cleared by sending bitten by the receiver hang bug. This can be cleared by sending
a set multicast list command. */ a set multicast list command. */
if (speedo_debug > 3) if (netif_msg_rx_err(sp))
printk(KERN_DEBUG "%s: Sending a multicast list set command" printk(KERN_DEBUG "%s: Sending a multicast list set command"
" from a timer routine," " from a timer routine,"
" m=%d, j=%ld, l=%ld.\n", " m=%d, j=%ld, l=%ld.\n",
...@@ -1209,20 +1221,17 @@ static void speedo_show_state(struct net_device *dev) ...@@ -1209,20 +1221,17 @@ static void speedo_show_state(struct net_device *dev)
int i; int i;
/* Print a few items for debugging. */ /* Print a few items for debugging. */
if (speedo_debug > 0) { printk(KERN_DEBUG "%s: Tx ring dump, Tx queue %u / %u:\n", dev->name,
int i; sp->cur_tx, sp->dirty_tx);
printk(KERN_DEBUG "%s: Tx ring dump, Tx queue %u / %u:\n", dev->name, for (i = 0; i < TX_RING_SIZE; i++)
sp->cur_tx, sp->dirty_tx); printk(KERN_DEBUG "%s: %c%c%2d %8.8x.\n", dev->name,
for (i = 0; i < TX_RING_SIZE; i++) i == sp->dirty_tx % TX_RING_SIZE ? '*' : ' ',
printk(KERN_DEBUG "%s: %c%c%2d %8.8x.\n", dev->name, i == sp->cur_tx % TX_RING_SIZE ? '=' : ' ',
i == sp->dirty_tx % TX_RING_SIZE ? '*' : ' ', i, sp->tx_ring[i].status);
i == sp->cur_tx % TX_RING_SIZE ? '=' : ' ',
i, sp->tx_ring[i].status);
}
printk(KERN_DEBUG "%s: Printing Rx ring" printk(KERN_DEBUG "%s: Printing Rx ring"
" (next to receive into %u, dirty index %u).\n", " (next to receive into %u, dirty index %u).\n",
dev->name, sp->cur_rx, sp->dirty_rx); dev->name, sp->cur_rx, sp->dirty_rx);
for (i = 0; i < RX_RING_SIZE; i++) for (i = 0; i < RX_RING_SIZE; i++)
printk(KERN_DEBUG "%s: %c%c%c%2d %8.8x.\n", dev->name, printk(KERN_DEBUG "%s: %c%c%c%2d %8.8x.\n", dev->name,
sp->rx_ringp[i] == sp->last_rxf ? 'l' : ' ', sp->rx_ringp[i] == sp->last_rxf ? 'l' : ' ',
...@@ -1315,7 +1324,7 @@ static void speedo_purge_tx(struct net_device *dev) ...@@ -1315,7 +1324,7 @@ static void speedo_purge_tx(struct net_device *dev)
} }
while (sp->mc_setup_head != NULL) { while (sp->mc_setup_head != NULL) {
struct speedo_mc_block *t; struct speedo_mc_block *t;
if (speedo_debug > 1) if (netif_msg_tx_err(sp))
printk(KERN_DEBUG "%s: freeing mc frame.\n", dev->name); printk(KERN_DEBUG "%s: freeing mc frame.\n", dev->name);
pci_unmap_single(sp->pdev, sp->mc_setup_head->frame_dma, pci_unmap_single(sp->pdev, sp->mc_setup_head->frame_dma,
sp->mc_setup_head->len, PCI_DMA_TODEVICE); sp->mc_setup_head->len, PCI_DMA_TODEVICE);
...@@ -1358,13 +1367,15 @@ static void speedo_tx_timeout(struct net_device *dev) ...@@ -1358,13 +1367,15 @@ static void speedo_tx_timeout(struct net_device *dev)
int status = inw(ioaddr + SCBStatus); int status = inw(ioaddr + SCBStatus);
unsigned long flags; unsigned long flags;
printk(KERN_WARNING "%s: Transmit timed out: status %4.4x " if (netif_msg_tx_err(sp)) {
printk(KERN_WARNING "%s: Transmit timed out: status %4.4x "
" %4.4x at %d/%d command %8.8x.\n", " %4.4x at %d/%d command %8.8x.\n",
dev->name, status, inw(ioaddr + SCBCmd), dev->name, status, inw(ioaddr + SCBCmd),
sp->dirty_tx, sp->cur_tx, sp->dirty_tx, sp->cur_tx,
sp->tx_ring[sp->dirty_tx % TX_RING_SIZE].status); sp->tx_ring[sp->dirty_tx % TX_RING_SIZE].status);
speedo_show_state(dev); speedo_show_state(dev);
}
#if 0 #if 0
if ((status & 0x00C0) != 0x0080 if ((status & 0x00C0) != 0x0080
&& (status & 0x003C) == 0x0010) { && (status & 0x003C) == 0x0010) {
...@@ -1491,14 +1502,14 @@ static void speedo_tx_buffer_gc(struct net_device *dev) ...@@ -1491,14 +1502,14 @@ static void speedo_tx_buffer_gc(struct net_device *dev)
int entry = dirty_tx % TX_RING_SIZE; int entry = dirty_tx % TX_RING_SIZE;
int status = le32_to_cpu(sp->tx_ring[entry].status); int status = le32_to_cpu(sp->tx_ring[entry].status);
if (speedo_debug > 5) if (netif_msg_tx_done(sp))
printk(KERN_DEBUG " scavenge candidate %d status %4.4x.\n", printk(KERN_DEBUG " scavenge candidate %d status %4.4x.\n",
entry, status); entry, status);
if ((status & StatusComplete) == 0) if ((status & StatusComplete) == 0)
break; /* It still hasn't been processed. */ break; /* It still hasn't been processed. */
if (status & TxUnderrun) if (status & TxUnderrun)
if (sp->tx_threshold < 0x01e08000) { if (sp->tx_threshold < 0x01e08000) {
if (speedo_debug > 2) if (netif_msg_tx_err(sp))
printk(KERN_DEBUG "%s: TX underrun, threshold adjusted.\n", printk(KERN_DEBUG "%s: TX underrun, threshold adjusted.\n",
dev->name); dev->name);
sp->tx_threshold += 0x00040000; sp->tx_threshold += 0x00040000;
...@@ -1516,7 +1527,7 @@ static void speedo_tx_buffer_gc(struct net_device *dev) ...@@ -1516,7 +1527,7 @@ static void speedo_tx_buffer_gc(struct net_device *dev)
dirty_tx++; dirty_tx++;
} }
if (speedo_debug && (int)(sp->cur_tx - dirty_tx) > TX_RING_SIZE) { if (netif_msg_tx_err(sp) && (int)(sp->cur_tx - dirty_tx) > TX_RING_SIZE) {
printk(KERN_ERR "out-of-sync dirty pointer, %d vs. %d," printk(KERN_ERR "out-of-sync dirty pointer, %d vs. %d,"
" full=%d.\n", " full=%d.\n",
dirty_tx, sp->cur_tx, sp->tx_full); dirty_tx, sp->cur_tx, sp->tx_full);
...@@ -1526,7 +1537,7 @@ static void speedo_tx_buffer_gc(struct net_device *dev) ...@@ -1526,7 +1537,7 @@ static void speedo_tx_buffer_gc(struct net_device *dev)
while (sp->mc_setup_head != NULL while (sp->mc_setup_head != NULL
&& (int)(dirty_tx - sp->mc_setup_head->tx - 1) > 0) { && (int)(dirty_tx - sp->mc_setup_head->tx - 1) > 0) {
struct speedo_mc_block *t; struct speedo_mc_block *t;
if (speedo_debug > 1) if (netif_msg_tx_err(sp))
printk(KERN_DEBUG "%s: freeing mc frame.\n", dev->name); printk(KERN_DEBUG "%s: freeing mc frame.\n", dev->name);
pci_unmap_single(sp->pdev, sp->mc_setup_head->frame_dma, pci_unmap_single(sp->pdev, sp->mc_setup_head->frame_dma,
sp->mc_setup_head->len, PCI_DMA_TODEVICE); sp->mc_setup_head->len, PCI_DMA_TODEVICE);
...@@ -1576,7 +1587,7 @@ static void speedo_interrupt(int irq, void *dev_instance, struct pt_regs *regs) ...@@ -1576,7 +1587,7 @@ static void speedo_interrupt(int irq, void *dev_instance, struct pt_regs *regs)
FCP and ER interrupts --Dragan */ FCP and ER interrupts --Dragan */
outw(status & 0xfc00, ioaddr + SCBStatus); outw(status & 0xfc00, ioaddr + SCBStatus);
if (speedo_debug > 4) if (netif_msg_intr(sp))
printk(KERN_DEBUG "%s: interrupt status=%#4.4x.\n", printk(KERN_DEBUG "%s: interrupt status=%#4.4x.\n",
dev->name, status); dev->name, status);
...@@ -1638,7 +1649,7 @@ static void speedo_interrupt(int irq, void *dev_instance, struct pt_regs *regs) ...@@ -1638,7 +1649,7 @@ static void speedo_interrupt(int irq, void *dev_instance, struct pt_regs *regs)
} }
} while (1); } while (1);
if (speedo_debug > 3) if (netif_msg_intr(sp))
printk(KERN_DEBUG "%s: exiting interrupt, status=%#4.4x.\n", printk(KERN_DEBUG "%s: exiting interrupt, status=%#4.4x.\n",
dev->name, inw(ioaddr + SCBStatus)); dev->name, inw(ioaddr + SCBStatus));
...@@ -1699,7 +1710,7 @@ static int speedo_refill_rx_buf(struct net_device *dev, int force) ...@@ -1699,7 +1710,7 @@ static int speedo_refill_rx_buf(struct net_device *dev, int force)
if (rxf == NULL) { if (rxf == NULL) {
unsigned int forw; unsigned int forw;
int forw_entry; int forw_entry;
if (speedo_debug > 2 || !(sp->rx_ring_state & RrOOMReported)) { if (netif_msg_rx_err(sp) || !(sp->rx_ring_state & RrOOMReported)) {
printk(KERN_WARNING "%s: can't fill rx buffer (force %d)!\n", printk(KERN_WARNING "%s: can't fill rx buffer (force %d)!\n",
dev->name, force); dev->name, force);
speedo_show_state(dev); speedo_show_state(dev);
...@@ -1746,7 +1757,7 @@ speedo_rx(struct net_device *dev) ...@@ -1746,7 +1757,7 @@ speedo_rx(struct net_device *dev)
int rx_work_limit = sp->dirty_rx + RX_RING_SIZE - sp->cur_rx; int rx_work_limit = sp->dirty_rx + RX_RING_SIZE - sp->cur_rx;
int alloc_ok = 1; int alloc_ok = 1;
if (speedo_debug > 4) if (netif_msg_intr(sp))
printk(KERN_DEBUG " In speedo_rx().\n"); printk(KERN_DEBUG " In speedo_rx().\n");
/* If we own the next entry, it's a new packet. Send it up. */ /* If we own the next entry, it's a new packet. Send it up. */
while (sp->rx_ringp[entry] != NULL) { while (sp->rx_ringp[entry] != NULL) {
...@@ -1769,14 +1780,14 @@ speedo_rx(struct net_device *dev) ...@@ -1769,14 +1780,14 @@ speedo_rx(struct net_device *dev)
if (sp->last_rxf == sp->rx_ringp[entry]) { if (sp->last_rxf == sp->rx_ringp[entry]) {
/* Postpone the packet. It'll be reaped at an interrupt when this /* Postpone the packet. It'll be reaped at an interrupt when this
packet is no longer the last packet in the ring. */ packet is no longer the last packet in the ring. */
if (speedo_debug > 2) if (netif_msg_rx_err(sp))
printk(KERN_DEBUG "%s: RX packet postponed!\n", printk(KERN_DEBUG "%s: RX packet postponed!\n",
dev->name); dev->name);
sp->rx_ring_state |= RrPostponed; sp->rx_ring_state |= RrPostponed;
break; break;
} }
if (speedo_debug > 4) if (netif_msg_intr(sp))
printk(KERN_DEBUG " speedo_rx() status %8.8x len %d.\n", status, printk(KERN_DEBUG " speedo_rx() status %8.8x len %d.\n", status,
pkt_len); pkt_len);
if ((status & (RxErrTooBig|RxOK|0x0f90)) != RxOK) { if ((status & (RxErrTooBig|RxOK|0x0f90)) != RxOK) {
...@@ -1857,7 +1868,7 @@ speedo_close(struct net_device *dev) ...@@ -1857,7 +1868,7 @@ speedo_close(struct net_device *dev)
netdevice_stop(dev); netdevice_stop(dev);
netif_stop_queue(dev); netif_stop_queue(dev);
if (speedo_debug > 1) if (netif_msg_ifdown(sp))
printk(KERN_DEBUG "%s: Shutting down ethercard, status was %4.4x.\n", printk(KERN_DEBUG "%s: Shutting down ethercard, status was %4.4x.\n",
dev->name, inw(ioaddr + SCBStatus)); dev->name, inw(ioaddr + SCBStatus));
...@@ -1870,7 +1881,7 @@ speedo_close(struct net_device *dev) ...@@ -1870,7 +1881,7 @@ speedo_close(struct net_device *dev)
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
/* Print a few items for debugging. */ /* Print a few items for debugging. */
if (speedo_debug > 3) if (netif_msg_ifdown(sp))
speedo_show_state(dev); speedo_show_state(dev);
/* Free all the skbuffs in the Rx and Tx queues. */ /* Free all the skbuffs in the Rx and Tx queues. */
...@@ -1906,7 +1917,7 @@ speedo_close(struct net_device *dev) ...@@ -1906,7 +1917,7 @@ speedo_close(struct net_device *dev)
sp->mc_setup_head = t; sp->mc_setup_head = t;
} }
sp->mc_setup_tail = NULL; sp->mc_setup_tail = NULL;
if (speedo_debug > 0) if (netif_msg_ifdown(sp))
printk(KERN_DEBUG "%s: %d multicast blocks dropped.\n", dev->name, i); printk(KERN_DEBUG "%s: %d multicast blocks dropped.\n", dev->name, i);
pci_set_power_state(sp->pdev, 2); pci_set_power_state(sp->pdev, 2);
...@@ -2009,6 +2020,22 @@ static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr) ...@@ -2009,6 +2020,22 @@ static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
/* get message-level */
case ETHTOOL_GMSGLVL: {
struct ethtool_value edata = {ETHTOOL_GMSGLVL};
edata.data = sp->msg_enable;
if (copy_to_user(useraddr, &edata, sizeof(edata)))
return -EFAULT;
return 0;
}
/* set message-level */
case ETHTOOL_SMSGLVL: {
struct ethtool_value edata;
if (copy_from_user(&edata, useraddr, sizeof(edata)))
return -EFAULT;
sp->msg_enable = edata.data;
return 0;
}
} }
...@@ -2083,7 +2110,7 @@ static void set_rx_mode(struct net_device *dev) ...@@ -2083,7 +2110,7 @@ static void set_rx_mode(struct net_device *dev)
} else } else
new_rx_mode = 0; new_rx_mode = 0;
if (speedo_debug > 3) if (netif_msg_rx_status(sp))
printk(KERN_DEBUG "%s: set_rx_mode %d -> %d\n", dev->name, printk(KERN_DEBUG "%s: set_rx_mode %d -> %d\n", dev->name,
sp->rx_mode, new_rx_mode); sp->rx_mode, new_rx_mode);
...@@ -2194,7 +2221,7 @@ static void set_rx_mode(struct net_device *dev) ...@@ -2194,7 +2221,7 @@ static void set_rx_mode(struct net_device *dev)
mc_setup_frm = &mc_blk->frame; mc_setup_frm = &mc_blk->frame;
/* Fill the setup frame. */ /* Fill the setup frame. */
if (speedo_debug > 1) if (netif_msg_ifup(sp))
printk(KERN_DEBUG "%s: Constructing a setup frame at %p.\n", printk(KERN_DEBUG "%s: Constructing a setup frame at %p.\n",
dev->name, mc_setup_frm); dev->name, mc_setup_frm);
mc_setup_frm->cmd_status = mc_setup_frm->cmd_status =
...@@ -2248,7 +2275,7 @@ static void set_rx_mode(struct net_device *dev) ...@@ -2248,7 +2275,7 @@ static void set_rx_mode(struct net_device *dev)
} }
spin_unlock_irqrestore(&sp->lock, flags); spin_unlock_irqrestore(&sp->lock, flags);
if (speedo_debug > 5) if (netif_msg_rx_status(sp))
printk(" CmdMCSetup frame length %d in entry %d.\n", printk(" CmdMCSetup frame length %d in entry %d.\n",
dev->mc_count, entry); dev->mc_count, entry);
} }
...@@ -2391,11 +2418,9 @@ static int pci_module_init(struct pci_driver *pdev) ...@@ -2391,11 +2418,9 @@ static int pci_module_init(struct pci_driver *pdev)
static int __init eepro100_init_module(void) static int __init eepro100_init_module(void)
{ {
if (debug >= 0 && speedo_debug != debug) #ifdef MODULE
printk(KERN_INFO "eepro100.c: Debug level is %d.\n", debug); printk(version);
if (debug >= 0) #endif
speedo_debug = debug;
return pci_module_init(&eepro100_driver); return pci_module_init(&eepro100_driver);
} }
......
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