2010-02-23 02:57:15

by Joe Perches

[permalink] [raw]
Subject: [PATCH net-next 0/7] drivers/net conversions to netdev_<level>, etc

Some more conversions of drivers to:

netif_<level>
netdev_<level>
pr_<level>

with some other minor updates/corrections
noticed during conversions.

Joe Perches (7):
drivers/net/chelsio: Use pr_<level>, netif_msg_<type>
drivers/net/myri10ge: Use pr_<level> and netdev_<level>
drivers/net/ixgbe: Use pr_<level> and netif_<level>
drivers/net/ixgb: Use pr_<level> and netdev_<level>
drivers/net/e1000: Use pr_<level> and netif_<level>
drivers/net/e1000e: Use pr_<level> and netdev_<level>
drivers/net/igb: Use netdev_<level>

drivers/net/chelsio/common.h | 24 +--
drivers/net/chelsio/cxgb2.c | 18 +-
drivers/net/chelsio/espi.c | 4 +-
drivers/net/chelsio/pm3393.c | 16 +-
drivers/net/chelsio/sge.c | 10 +-
drivers/net/chelsio/subr.c | 32 ++--
drivers/net/chelsio/vsc7326.c | 24 ++--
drivers/net/e1000/e1000.h | 17 --
drivers/net/e1000/e1000_ethtool.c | 38 ++--
drivers/net/e1000/e1000_hw.c | 383 ++++++++++++++++++-------------------
drivers/net/e1000/e1000_main.c | 272 +++++++++++++-------------
drivers/net/e1000/e1000_osdep.h | 14 +--
drivers/net/e1000/e1000_param.c | 121 +++++++------
drivers/net/e1000e/82571.c | 57 ++++--
drivers/net/e1000e/e1000.h | 21 --
drivers/net/e1000e/es2lan.c | 27 ++--
drivers/net/e1000e/ethtool.c | 37 ++--
drivers/net/e1000e/ich8lan.c | 90 +++++----
drivers/net/e1000e/lib.c | 131 +++++++-------
drivers/net/e1000e/netdev.c | 95 +++++-----
drivers/net/e1000e/param.c | 20 +-
drivers/net/e1000e/phy.c | 114 ++++++------
drivers/net/igb/e1000_82575.c | 58 +++---
drivers/net/igb/e1000_hw.h | 12 +-
drivers/net/igb/e1000_mac.c | 84 ++++----
drivers/net/igb/e1000_nvm.c | 22 +-
drivers/net/igb/e1000_phy.c | 104 +++++-----
drivers/net/igb/igb.h | 1 -
drivers/net/igb/igb_ethtool.c | 6 +-
drivers/net/igb/igb_main.c | 43 ++---
drivers/net/ixgb/ixgb.h | 8 +-
drivers/net/ixgb/ixgb_ee.c | 14 +-
drivers/net/ixgb/ixgb_hw.c | 147 ++++++---------
drivers/net/ixgb/ixgb_hw.h | 12 --
drivers/net/ixgb/ixgb_main.c | 33 ++--
drivers/net/ixgb/ixgb_osdep.h | 16 +--
drivers/net/ixgb/ixgb_param.c | 31 ++--
drivers/net/ixgbe/ixgbe.h | 6 -
drivers/net/ixgbe/ixgbe_common.h | 15 +-
drivers/net/ixgbe/ixgbe_dcb_nl.c | 5 +-
drivers/net/ixgbe/ixgbe_ethtool.c | 40 +++--
drivers/net/ixgbe/ixgbe_fcoe.c | 25 ++--
drivers/net/ixgbe/ixgbe_main.c | 110 +++++------
drivers/net/ixgbe/ixgbe_phy.c | 2 +
drivers/net/ixgbe/ixgbe_sriov.c | 11 +-
drivers/net/myri10ge/myri10ge.c | 183 +++++++-----------
46 files changed, 1202 insertions(+), 1351 deletions(-)


2010-02-23 02:57:23

by Joe Perches

[permalink] [raw]
Subject: [PATCH net-next 1/7] drivers/net/chelsio: Use pr_<level>, netif_msg_<type>

Convert CH_<level> and CH_DBG uses to pr_<level> and netif equivalents
Remove CH_<level> and CH_DBG macro definitions

Signed-off-by: Joe Perches <[email protected]>
---
drivers/net/chelsio/common.h | 24 ++----------------------
drivers/net/chelsio/cxgb2.c | 18 +++++++++---------
drivers/net/chelsio/espi.c | 4 ++--
drivers/net/chelsio/pm3393.c | 16 +++++++++-------
drivers/net/chelsio/sge.c | 10 +++++-----
drivers/net/chelsio/subr.c | 32 +++++++++++++++++---------------
drivers/net/chelsio/vsc7326.c | 24 ++++++++++++------------
7 files changed, 56 insertions(+), 72 deletions(-)

diff --git a/drivers/net/chelsio/common.h b/drivers/net/chelsio/common.h
index 9f89fd6..2d11afe 100644
--- a/drivers/net/chelsio/common.h
+++ b/drivers/net/chelsio/common.h
@@ -36,6 +36,8 @@
* *
****************************************************************************/

+#define pr_fmt(fmt) "cxgb: " fmt
+
#ifndef _CXGB_COMMON_H_
#define _CXGB_COMMON_H_

@@ -55,28 +57,6 @@
#define DRV_DESCRIPTION "Chelsio 10Gb Ethernet Driver"
#define DRV_NAME "cxgb"
#define DRV_VERSION "2.2"
-#define PFX DRV_NAME ": "
-
-#define CH_ERR(fmt, ...) printk(KERN_ERR PFX fmt, ## __VA_ARGS__)
-#define CH_WARN(fmt, ...) printk(KERN_WARNING PFX fmt, ## __VA_ARGS__)
-#define CH_ALERT(fmt, ...) printk(KERN_ALERT PFX fmt, ## __VA_ARGS__)
-
-/*
- * More powerful macro that selectively prints messages based on msg_enable.
- * For info and debugging messages.
- */
-#define CH_MSG(adapter, level, category, fmt, ...) do { \
- if ((adapter)->msg_enable & NETIF_MSG_##category) \
- printk(KERN_##level PFX "%s: " fmt, (adapter)->name, \
- ## __VA_ARGS__); \
-} while (0)
-
-#ifdef DEBUG
-# define CH_DBG(adapter, category, fmt, ...) \
- CH_MSG(adapter, DEBUG, category, fmt, ## __VA_ARGS__)
-#else
-# define CH_DBG(fmt, ...)
-#endif

#define CH_DEVICE(devid, ssid, idx) \
{ PCI_VENDOR_ID_CHELSIO, devid, PCI_ANY_ID, ssid, 0, 0, idx }
diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c
index a54a32b..0f71304 100644
--- a/drivers/net/chelsio/cxgb2.c
+++ b/drivers/net/chelsio/cxgb2.c
@@ -974,7 +974,7 @@ void t1_fatal_err(struct adapter *adapter)
t1_sge_stop(adapter->sge);
t1_interrupts_disable(adapter);
}
- CH_ALERT("%s: encountered fatal error, operation suspended\n",
+ pr_alert("%s: encountered fatal error, operation suspended\n",
adapter->name);
}

@@ -1018,7 +1018,7 @@ static int __devinit init_one(struct pci_dev *pdev,
return err;

if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) {
- CH_ERR("%s: cannot find PCI device memory base address\n",
+ pr_err("%s: cannot find PCI device memory base address\n",
pci_name(pdev));
err = -ENODEV;
goto out_disable_pdev;
@@ -1028,20 +1028,20 @@ static int __devinit init_one(struct pci_dev *pdev,
pci_using_dac = 1;

if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) {
- CH_ERR("%s: unable to obtain 64-bit DMA for "
+ pr_err("%s: unable to obtain 64-bit DMA for "
"consistent allocations\n", pci_name(pdev));
err = -ENODEV;
goto out_disable_pdev;
}

} else if ((err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) != 0) {
- CH_ERR("%s: no usable DMA configuration\n", pci_name(pdev));
+ pr_err("%s: no usable DMA configuration\n", pci_name(pdev));
goto out_disable_pdev;
}

err = pci_request_regions(pdev, DRV_NAME);
if (err) {
- CH_ERR("%s: cannot obtain PCI resources\n", pci_name(pdev));
+ pr_err("%s: cannot obtain PCI resources\n", pci_name(pdev));
goto out_disable_pdev;
}

@@ -1069,7 +1069,7 @@ static int __devinit init_one(struct pci_dev *pdev,

adapter->regs = ioremap(mmio_start, mmio_len);
if (!adapter->regs) {
- CH_ERR("%s: cannot map device registers\n",
+ pr_err("%s: cannot map device registers\n",
pci_name(pdev));
err = -ENOMEM;
goto out_free_dev;
@@ -1148,8 +1148,8 @@ static int __devinit init_one(struct pci_dev *pdev,
for (i = 0; i < bi->port_number; ++i) {
err = register_netdev(adapter->port[i].dev);
if (err)
- CH_WARN("%s: cannot register net device %s, skipping\n",
- pci_name(pdev), adapter->port[i].dev->name);
+ pr_warning("%s: cannot register net device %s, skipping\n",
+ pci_name(pdev), adapter->port[i].dev->name);
else {
/*
* Change the name we use for messages to the name of
@@ -1162,7 +1162,7 @@ static int __devinit init_one(struct pci_dev *pdev,
}
}
if (!adapter->registered_device_map) {
- CH_ERR("%s: could not register any net devices\n",
+ pr_err("%s: could not register any net devices\n",
pci_name(pdev));
goto out_release_adapter_res;
}
diff --git a/drivers/net/chelsio/espi.c b/drivers/net/chelsio/espi.c
index 1e0749e..639ff19 100644
--- a/drivers/net/chelsio/espi.c
+++ b/drivers/net/chelsio/espi.c
@@ -76,7 +76,7 @@ static int tricn_write(adapter_t *adapter, int bundle_addr, int module_addr,
} while (busy && --attempts);

if (busy)
- CH_ERR("%s: TRICN write timed out\n", adapter->name);
+ pr_err("%s: TRICN write timed out\n", adapter->name);

return busy;
}
@@ -86,7 +86,7 @@ static int tricn_init(adapter_t *adapter)
int i, sme = 1;

if (!(readl(adapter->regs + A_ESPI_RX_RESET) & F_RX_CLK_STATUS)) {
- CH_ERR("%s: ESPI clock not ready\n", adapter->name);
+ pr_err("%s: ESPI clock not ready\n", adapter->name);
return -1;
}

diff --git a/drivers/net/chelsio/pm3393.c b/drivers/net/chelsio/pm3393.c
index 33d674f..a6eb30a 100644
--- a/drivers/net/chelsio/pm3393.c
+++ b/drivers/net/chelsio/pm3393.c
@@ -251,8 +251,9 @@ static int pm3393_interrupt_handler(struct cmac *cmac)
/* Read the master interrupt status register. */
pmread(cmac, SUNI1x10GEXP_REG_MASTER_INTERRUPT_STATUS,
&master_intr_status);
- CH_DBG(cmac->adapter, INTR, "PM3393 intr cause 0x%x\n",
- master_intr_status);
+ if (netif_msg_intr(cmac->adapter))
+ dev_dbg(&cmac->adapter->pdev->dev, "PM3393 intr cause 0x%x\n",
+ master_intr_status);

/* TBD XXX Lets just clear everything for now */
pm3393_interrupt_clear(cmac);
@@ -776,11 +777,12 @@ static int pm3393_mac_reset(adapter_t * adapter)
successful_reset = (is_pl4_reset_finished && !is_pl4_outof_lock
&& is_xaui_mabc_pll_locked);

- CH_DBG(adapter, HW,
- "PM3393 HW reset %d: pl4_reset 0x%x, val 0x%x, "
- "is_pl4_outof_lock 0x%x, xaui_locked 0x%x\n",
- i, is_pl4_reset_finished, val, is_pl4_outof_lock,
- is_xaui_mabc_pll_locked);
+ if (netif_msg_hw(adapter))
+ dev_dbg(&adapter->pdev->dev,
+ "PM3393 HW reset %d: pl4_reset 0x%x, val 0x%x, "
+ "is_pl4_outof_lock 0x%x, xaui_locked 0x%x\n",
+ i, is_pl4_reset_finished, val,
+ is_pl4_outof_lock, is_xaui_mabc_pll_locked);
}
return successful_reset ? 0 : 1;
}
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c
index 8e12505..7138411 100644
--- a/drivers/net/chelsio/sge.c
+++ b/drivers/net/chelsio/sge.c
@@ -953,7 +953,7 @@ int t1_sge_intr_error_handler(struct sge *sge)
sge->stats.respQ_empty++;
if (cause & F_RESPQ_OVERFLOW) {
sge->stats.respQ_overflow++;
- CH_ALERT("%s: SGE response queue overflow\n",
+ pr_alert("%s: SGE response queue overflow\n",
adapter->name);
}
if (cause & F_FL_EXHAUSTED) {
@@ -962,12 +962,12 @@ int t1_sge_intr_error_handler(struct sge *sge)
}
if (cause & F_PACKET_TOO_BIG) {
sge->stats.pkt_too_big++;
- CH_ALERT("%s: SGE max packet size exceeded\n",
+ pr_alert("%s: SGE max packet size exceeded\n",
adapter->name);
}
if (cause & F_PACKET_MISMATCH) {
sge->stats.pkt_mismatch++;
- CH_ALERT("%s: SGE packet mismatch\n", adapter->name);
+ pr_alert("%s: SGE packet mismatch\n", adapter->name);
}
if (cause & SGE_INT_FATAL)
t1_fatal_err(adapter);
@@ -1101,7 +1101,7 @@ static void unexpected_offload(struct adapter *adapter, struct freelQ *fl)

pci_dma_sync_single_for_cpu(adapter->pdev, pci_unmap_addr(ce, dma_addr),
pci_unmap_len(ce, dma_len), PCI_DMA_FROMDEVICE);
- CH_ERR("%s: unexpected offload packet, cmd %u\n",
+ pr_err("%s: unexpected offload packet, cmd %u\n",
adapter->name, *skb->data);
recycle_fl_buf(fl, fl->cidx);
}
@@ -1687,7 +1687,7 @@ static int t1_sge_tx(struct sk_buff *skb, struct adapter *adapter,
netif_stop_queue(dev);
set_bit(dev->if_port, &sge->stopped_tx_queues);
sge->stats.cmdQ_full[2]++;
- CH_ERR("%s: Tx ring full while queue awake!\n",
+ pr_err("%s: Tx ring full while queue awake!\n",
adapter->name);
}
spin_unlock(&q->lock);
diff --git a/drivers/net/chelsio/subr.c b/drivers/net/chelsio/subr.c
index 2402d37..2c2dda3 100644
--- a/drivers/net/chelsio/subr.c
+++ b/drivers/net/chelsio/subr.c
@@ -90,7 +90,7 @@ int __t1_tpi_write(adapter_t *adapter, u32 addr, u32 value)
tpi_busy = t1_wait_op_done(adapter, A_TPI_CSR, F_TPIRDY, 1,
TPI_ATTEMPTS, 3);
if (tpi_busy)
- CH_ALERT("%s: TPI write to 0x%x failed\n",
+ pr_alert("%s: TPI write to 0x%x failed\n",
adapter->name, addr);
return tpi_busy;
}
@@ -118,7 +118,7 @@ int __t1_tpi_read(adapter_t *adapter, u32 addr, u32 *valp)
tpi_busy = t1_wait_op_done(adapter, A_TPI_CSR, F_TPIRDY, 1,
TPI_ATTEMPTS, 3);
if (tpi_busy)
- CH_ALERT("%s: TPI read from 0x%x failed\n",
+ pr_alert("%s: TPI read from 0x%x failed\n",
adapter->name, addr);
else
*valp = readl(adapter->regs + A_TPI_RD_DATA);
@@ -262,7 +262,7 @@ static int mi1_wait_until_ready(adapter_t *adapter, int mi1_reg)
udelay(10);
} while (busy && --attempts);
if (busy)
- CH_ALERT("%s: MDIO operation timed out\n", adapter->name);
+ pr_alert("%s: MDIO operation timed out\n", adapter->name);
return busy;
}

@@ -581,7 +581,7 @@ int t1_seeprom_read(adapter_t *adapter, u32 addr, __le32 *data)
} while (!(val & F_VPD_OP_FLAG) && --i);

if (!(val & F_VPD_OP_FLAG)) {
- CH_ERR("%s: reading EEPROM address 0x%x failed\n",
+ pr_err("%s: reading EEPROM address 0x%x failed\n",
adapter->name, addr);
return -EIO;
}
@@ -734,8 +734,9 @@ int t1_elmer0_ext_intr_handler(adapter_t *adapter)
break;
case CHBT_BOARD_8000:
case CHBT_BOARD_CHT110:
- CH_DBG(adapter, INTR, "External interrupt cause 0x%x\n",
- cause);
+ if (netif_msg_intr(adapter))
+ dev_dbg(&adapter->pdev->dev,
+ "External interrupt cause 0x%x\n", cause);
if (cause & ELMER0_GP_BIT1) { /* PMC3393 INTB */
struct cmac *mac = adapter->port[0].mac;

@@ -746,8 +747,9 @@ int t1_elmer0_ext_intr_handler(adapter_t *adapter)

t1_tpi_read(adapter,
A_ELMER0_GPI_STAT, &mod_detect);
- CH_MSG(adapter, INFO, LINK, "XPAK %s\n",
- mod_detect ? "removed" : "inserted");
+ if (netif_msg_link(adapter))
+ dev_info(&adapter->pdev->dev, "XPAK %s\n",
+ mod_detect ? "removed" : "inserted");
}
break;
#ifdef CONFIG_CHELSIO_T1_COUGAR
@@ -1084,7 +1086,7 @@ static void __devinit init_link_config(struct link_config *lc,

#ifdef CONFIG_CHELSIO_T1_COUGAR
if (bi->clock_cspi && !(adapter->cspi = t1_cspi_create(adapter))) {
- CH_ERR("%s: CSPI initialization failed\n",
+ pr_err("%s: CSPI initialization failed\n",
adapter->name);
goto error;
}
@@ -1105,20 +1107,20 @@ int __devinit t1_init_sw_modules(adapter_t *adapter,

adapter->sge = t1_sge_create(adapter, &adapter->params.sge);
if (!adapter->sge) {
- CH_ERR("%s: SGE initialization failed\n",
+ pr_err("%s: SGE initialization failed\n",
adapter->name);
goto error;
}

if (bi->espi_nports && !(adapter->espi = t1_espi_create(adapter))) {
- CH_ERR("%s: ESPI initialization failed\n",
+ pr_err("%s: ESPI initialization failed\n",
adapter->name);
goto error;
}

adapter->tp = t1_tp_create(adapter, &adapter->params.tp);
if (!adapter->tp) {
- CH_ERR("%s: TP initialization failed\n",
+ pr_err("%s: TP initialization failed\n",
adapter->name);
goto error;
}
@@ -1138,14 +1140,14 @@ int __devinit t1_init_sw_modules(adapter_t *adapter,
adapter->port[i].phy = bi->gphy->create(adapter->port[i].dev,
phy_addr, bi->mdio_ops);
if (!adapter->port[i].phy) {
- CH_ERR("%s: PHY %d initialization failed\n",
+ pr_err("%s: PHY %d initialization failed\n",
adapter->name, i);
goto error;
}

adapter->port[i].mac = mac = bi->gmac->create(adapter, i);
if (!mac) {
- CH_ERR("%s: MAC %d initialization failed\n",
+ pr_err("%s: MAC %d initialization failed\n",
adapter->name, i);
goto error;
}
@@ -1157,7 +1159,7 @@ int __devinit t1_init_sw_modules(adapter_t *adapter,
if (!t1_is_asic(adapter) || bi->chip_mac == CHBT_MAC_DUMMY)
mac->ops->macaddress_get(mac, hw_addr);
else if (vpd_macaddress_get(adapter, i, hw_addr)) {
- CH_ERR("%s: could not read MAC address from VPD ROM\n",
+ pr_err("%s: could not read MAC address from VPD ROM\n",
adapter->port[i].dev->name);
goto error;
}
diff --git a/drivers/net/chelsio/vsc7326.c b/drivers/net/chelsio/vsc7326.c
index 99b51f6..c844111 100644
--- a/drivers/net/chelsio/vsc7326.c
+++ b/drivers/net/chelsio/vsc7326.c
@@ -48,14 +48,14 @@ static void vsc_read(adapter_t *adapter, u32 addr, u32 *val)
i++;
} while (((status & 1) == 0) && (i < 50));
if (i == 50)
- CH_ERR("Invalid tpi read from MAC, breaking loop.\n");
+ pr_err("Invalid tpi read from MAC, breaking loop.\n");

t1_tpi_read(adapter, (REG_LOCAL_DATA << 2) + 4, &vlo);
t1_tpi_read(adapter, REG_LOCAL_DATA << 2, &vhi);

*val = (vhi << 16) | vlo;

- /* CH_ERR("rd: block: 0x%x sublock: 0x%x reg: 0x%x data: 0x%x\n",
+ /* pr_err("rd: block: 0x%x sublock: 0x%x reg: 0x%x data: 0x%x\n",
((addr&0xe000)>>13), ((addr&0x1e00)>>9),
((addr&0x01fe)>>1), *val); */
spin_unlock_bh(&adapter->mac_lock);
@@ -66,7 +66,7 @@ static void vsc_write(adapter_t *adapter, u32 addr, u32 data)
spin_lock_bh(&adapter->mac_lock);
t1_tpi_write(adapter, (addr << 2) + 4, data & 0xFFFF);
t1_tpi_write(adapter, addr << 2, (data >> 16) & 0xFFFF);
- /* CH_ERR("wr: block: 0x%x sublock: 0x%x reg: 0x%x data: 0x%x\n",
+ /* pr_err("wr: block: 0x%x sublock: 0x%x reg: 0x%x data: 0x%x\n",
((addr&0xe000)>>13), ((addr&0x1e00)>>9),
((addr&0x01fe)>>1), data); */
spin_unlock_bh(&adapter->mac_lock);
@@ -225,7 +225,7 @@ static void run_table(adapter_t *adapter, struct init_table *ib, int len)
for (i = 0; i < len; i++) {
if (ib[i].addr == INITBLOCK_SLEEP) {
udelay( ib[i].data );
- CH_ERR("sleep %d us\n",ib[i].data);
+ pr_err("sleep %d us\n",ib[i].data);
} else
vsc_write( adapter, ib[i].addr, ib[i].data );
}
@@ -241,7 +241,7 @@ static int bist_rd(adapter_t *adapter, int moduleid, int address)
(address != 0x2) &&
(address != 0xd) &&
(address != 0xe))
- CH_ERR("No bist address: 0x%x\n", address);
+ pr_err("No bist address: 0x%x\n", address);

data = ((0x00 << 24) | ((address & 0xff) << 16) | (0x00 << 8) |
((moduleid & 0xff) << 0));
@@ -251,9 +251,9 @@ static int bist_rd(adapter_t *adapter, int moduleid, int address)

vsc_read(adapter, REG_RAM_BIST_RESULT, &result);
if ((result & (1 << 9)) != 0x0)
- CH_ERR("Still in bist read: 0x%x\n", result);
+ pr_err("Still in bist read: 0x%x\n", result);
else if ((result & (1 << 8)) != 0x0)
- CH_ERR("bist read error: 0x%x\n", result);
+ pr_err("bist read error: 0x%x\n", result);

return (result & 0xff);
}
@@ -268,10 +268,10 @@ static int bist_wr(adapter_t *adapter, int moduleid, int address, int value)
(address != 0x2) &&
(address != 0xd) &&
(address != 0xe))
- CH_ERR("No bist address: 0x%x\n", address);
+ pr_err("No bist address: 0x%x\n", address);

if (value > 255)
- CH_ERR("Suspicious write out of range value: 0x%x\n", value);
+ pr_err("Suspicious write out of range value: 0x%x\n", value);

data = ((0x01 << 24) | ((address & 0xff) << 16) | (value << 8) |
((moduleid & 0xff) << 0));
@@ -281,9 +281,9 @@ static int bist_wr(adapter_t *adapter, int moduleid, int address, int value)

vsc_read(adapter, REG_RAM_BIST_CMD, &result);
if ((result & (1 << 27)) != 0x0)
- CH_ERR("Still in bist write: 0x%x\n", result);
+ pr_err("Still in bist write: 0x%x\n", result);
else if ((result & (1 << 26)) != 0x0)
- CH_ERR("bist write error: 0x%x\n", result);
+ pr_err("bist write error: 0x%x\n", result);

return 0;
}
@@ -306,7 +306,7 @@ static int check_bist(adapter_t *adapter, int moduleid)
column = ((bist_rd(adapter,moduleid, 0x0e)<<8) +
(bist_rd(adapter,moduleid, 0x0d)));
if ((result & 3) != 0x3)
- CH_ERR("Result: 0x%x BIST error in ram %d, column: 0x%04x\n",
+ pr_err("Result: 0x%x BIST error in ram %d, column: 0x%04x\n",
result, moduleid, column);
return 0;
}
--
1.7.0.14.g7e948

2010-02-23 02:57:50

by Joe Perches

[permalink] [raw]
Subject: [PATCH net-next 5/7] drivers/net/e1000: Use pr_<level> and netif_<level>

Convert DPRINTK, commonly used for debugging, to netif_<level>
Remove #define PFX
Use #define pr_fmt
Convert DEBUGOUTx to pr_debug
Convert DEBUGFUNC to more commonly used ENTER()
Convert some printks to pr_<level>
Coalesce long formats

Signed-off-by: Joe Perches <[email protected]>
---
drivers/net/e1000/e1000.h | 17 --
drivers/net/e1000/e1000_ethtool.c | 38 ++--
drivers/net/e1000/e1000_hw.c | 383 ++++++++++++++++++-------------------
drivers/net/e1000/e1000_main.c | 272 +++++++++++++-------------
drivers/net/e1000/e1000_osdep.h | 14 +--
drivers/net/e1000/e1000_param.c | 121 +++++++------
6 files changed, 409 insertions(+), 436 deletions(-)

diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
index 9902b33..6c11fb0 100644
--- a/drivers/net/e1000/e1000.h
+++ b/drivers/net/e1000/e1000.h
@@ -81,23 +81,6 @@ struct e1000_adapter;

#include "e1000_hw.h"

-#ifdef DBG
-#define E1000_DBG(args...) printk(KERN_DEBUG "e1000: " args)
-#else
-#define E1000_DBG(args...)
-#endif
-
-#define E1000_ERR(args...) printk(KERN_ERR "e1000: " args)
-
-#define PFX "e1000: "
-
-#define DPRINTK(nlevel, klevel, fmt, args...) \
-do { \
- if (NETIF_MSG_##nlevel & adapter->msg_enable) \
- printk(KERN_##klevel PFX "%s: %s: " fmt, \
- adapter->netdev->name, __func__, ##args); \
-} while (0)
-
#define E1000_MAX_INTR 10

/* TX/RX descriptor defines */
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index c67e931..715be7c 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -346,7 +346,8 @@ static int e1000_set_tso(struct net_device *netdev, u32 data)

netdev->features &= ~NETIF_F_TSO6;

- DPRINTK(PROBE, INFO, "TSO is %s\n", data ? "Enabled" : "Disabled");
+ netif_info(adapter, probe, adapter->netdev,
+ "TSO is %s\n", data ? "Enabled" : "Disabled");
adapter->tso_force = true;
return 0;
}
@@ -714,9 +715,9 @@ static bool reg_pattern_test(struct e1000_adapter *adapter, u64 *data, int reg,
writel(write & test[i], address);
read = readl(address);
if (read != (write & test[i] & mask)) {
- DPRINTK(DRV, ERR, "pattern test reg %04X failed: "
- "got 0x%08X expected 0x%08X\n",
- reg, read, (write & test[i] & mask));
+ netif_err(adapter, drv, adapter->netdev,
+ "pattern test reg %04X failed: got 0x%08X expected 0x%08X\n",
+ reg, read, (write & test[i] & mask));
*data = reg;
return true;
}
@@ -734,9 +735,9 @@ static bool reg_set_and_check(struct e1000_adapter *adapter, u64 *data, int reg,
writel(write & mask, address);
read = readl(address);
if ((read & mask) != (write & mask)) {
- DPRINTK(DRV, ERR, "set/check reg %04X test failed: "
- "got 0x%08X expected 0x%08X\n",
- reg, (read & mask), (write & mask));
+ netif_err(adapter, drv, adapter->netdev,
+ "set/check reg %04X test failed: got 0x%08X expected 0x%08X\n",
+ reg, (read & mask), (write & mask));
*data = reg;
return true;
}
@@ -779,8 +780,9 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data)
ew32(STATUS, toggle);
after = er32(STATUS) & toggle;
if (value != after) {
- DPRINTK(DRV, ERR, "failed STATUS register test got: "
- "0x%08X expected: 0x%08X\n", after, value);
+ netif_err(adapter, drv, adapter->netdev,
+ "failed STATUS register test got: 0x%08X expected: 0x%08X\n",
+ after, value);
*data = 1;
return 1;
}
@@ -894,8 +896,8 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
*data = 1;
return -1;
}
- DPRINTK(HW, INFO, "testing %s interrupt\n",
- (shared_int ? "shared" : "unshared"));
+ netif_info(adapter, hw, adapter->netdev, "testing %s interrupt\n",
+ shared_int ? "shared" : "unshared");

/* Disable all the interrupts */
ew32(IMC, 0xFFFFFFFF);
@@ -1558,7 +1560,8 @@ static void e1000_diag_test(struct net_device *netdev,
u8 forced_speed_duplex = hw->forced_speed_duplex;
u8 autoneg = hw->autoneg;

- DPRINTK(HW, INFO, "offline testing starting\n");
+ netif_info(adapter, hw, adapter->netdev,
+ "offline testing starting\n");

/* Link test performed before hardware reset so autoneg doesn't
* interfere with test result */
@@ -1598,7 +1601,8 @@ static void e1000_diag_test(struct net_device *netdev,
if (if_running)
dev_open(netdev);
} else {
- DPRINTK(HW, INFO, "online testing starting\n");
+ netif_info(adapter, hw, adapter->netdev,
+ "online testing starting\n");
/* Online tests */
if (e1000_link_test(adapter, &data[4]))
eth_test->flags |= ETH_TEST_FL_FAILED;
@@ -1691,8 +1695,8 @@ static void e1000_get_wol(struct net_device *netdev,
wol->supported &= ~WAKE_UCAST;

if (adapter->wol & E1000_WUFC_EX)
- DPRINTK(DRV, ERR, "Interface does not support "
- "directed (unicast) frame wake-up packets\n");
+ netif_err(adapter, drv, adapter->netdev,
+ "Interface does not support directed (unicast) frame wake-up packets\n");
break;
default:
break;
@@ -1725,8 +1729,8 @@ static int e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
switch (hw->device_id) {
case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3:
if (wol->wolopts & WAKE_UCAST) {
- DPRINTK(DRV, ERR, "Interface does not support "
- "directed (unicast) frame wake-up packets\n");
+ netif_err(adapter, drv, adapter->netdev,
+ "Interface does not support directed (unicast) frame wake-up packets\n");
return -EOPNOTSUPP;
}
break;
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index 8d7d87f..6d16f3f 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -30,6 +30,8 @@
* Shared functions for accessing and configuring the MAC
*/

+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include "e1000_hw.h"

static s32 e1000_check_downshift(struct e1000_hw *hw);
@@ -114,7 +116,7 @@ static DEFINE_SPINLOCK(e1000_eeprom_lock);
*/
static s32 e1000_set_phy_type(struct e1000_hw *hw)
{
- DEBUGFUNC("e1000_set_phy_type");
+ ENTER();

if (hw->mac_type == e1000_undefined)
return -E1000_ERR_PHY_TYPE;
@@ -152,7 +154,7 @@ static void e1000_phy_init_script(struct e1000_hw *hw)
u32 ret_val;
u16 phy_saved_data;

- DEBUGFUNC("e1000_phy_init_script");
+ ENTER();

if (hw->phy_init_script) {
msleep(20);
@@ -245,7 +247,7 @@ static void e1000_phy_init_script(struct e1000_hw *hw)
*/
s32 e1000_set_mac_type(struct e1000_hw *hw)
{
- DEBUGFUNC("e1000_set_mac_type");
+ ENTER();

switch (hw->device_id) {
case E1000_DEV_ID_82542:
@@ -354,7 +356,7 @@ void e1000_set_media_type(struct e1000_hw *hw)
{
u32 status;

- DEBUGFUNC("e1000_set_media_type");
+ ENTER();

if (hw->mac_type != e1000_82543) {
/* tbi_compatibility is only valid on 82543 */
@@ -401,16 +403,16 @@ s32 e1000_reset_hw(struct e1000_hw *hw)
u32 led_ctrl;
s32 ret_val;

- DEBUGFUNC("e1000_reset_hw");
+ ENTER();

/* For 82542 (rev 2.0), disable MWI before issuing a device reset */
if (hw->mac_type == e1000_82542_rev2_0) {
- DEBUGOUT("Disabling MWI on 82542 rev 2.0\n");
+ pr_debug("Disabling MWI on 82542 rev 2.0\n");
e1000_pci_clear_mwi(hw);
}

/* Clear interrupt mask to stop board from generating interrupts */
- DEBUGOUT("Masking off all interrupts\n");
+ pr_debug("Masking off all interrupts\n");
ew32(IMC, 0xffffffff);

/* Disable the Transmit and Receive units. Then delay to allow
@@ -442,7 +444,7 @@ s32 e1000_reset_hw(struct e1000_hw *hw)
* the current PCI configuration. The global reset bit is self-
* clearing, and should clear within a microsecond.
*/
- DEBUGOUT("Issuing a global reset to MAC\n");
+ pr_debug("Issuing a global reset to MAC\n");

switch (hw->mac_type) {
case e1000_82544:
@@ -516,7 +518,7 @@ s32 e1000_reset_hw(struct e1000_hw *hw)
}

/* Clear interrupt mask to stop board from generating interrupts */
- DEBUGOUT("Masking off all interrupts\n");
+ pr_debug("Masking off all interrupts\n");
ew32(IMC, 0xffffffff);

/* Clear any pending interrupt events. */
@@ -549,12 +551,12 @@ s32 e1000_init_hw(struct e1000_hw *hw)
u32 mta_size;
u32 ctrl_ext;

- DEBUGFUNC("e1000_init_hw");
+ ENTER();

/* Initialize Identification LED */
ret_val = e1000_id_led_init(hw);
if (ret_val) {
- DEBUGOUT("Error Initializing Identification LED\n");
+ pr_debug("Error Initializing Identification LED\n");
return ret_val;
}

@@ -562,14 +564,14 @@ s32 e1000_init_hw(struct e1000_hw *hw)
e1000_set_media_type(hw);

/* Disabling VLAN filtering. */
- DEBUGOUT("Initializing the IEEE VLAN\n");
+ pr_debug("Initializing the IEEE VLAN\n");
if (hw->mac_type < e1000_82545_rev_3)
ew32(VET, 0);
e1000_clear_vfta(hw);

/* For 82542 (rev 2.0), disable MWI and put the receiver into reset */
if (hw->mac_type == e1000_82542_rev2_0) {
- DEBUGOUT("Disabling MWI on 82542 rev 2.0\n");
+ pr_debug("Disabling MWI on 82542 rev 2.0\n");
e1000_pci_clear_mwi(hw);
ew32(RCTL, E1000_RCTL_RST);
E1000_WRITE_FLUSH();
@@ -591,7 +593,7 @@ s32 e1000_init_hw(struct e1000_hw *hw)
}

/* Zero out the Multicast HASH table */
- DEBUGOUT("Zeroing the MTA\n");
+ pr_debug("Zeroing the MTA\n");
mta_size = E1000_MC_TBL_SIZE;
for (i = 0; i < mta_size; i++) {
E1000_WRITE_REG_ARRAY(hw, MTA, i, 0);
@@ -662,7 +664,7 @@ static s32 e1000_adjust_serdes_amplitude(struct e1000_hw *hw)
u16 eeprom_data;
s32 ret_val;

- DEBUGFUNC("e1000_adjust_serdes_amplitude");
+ ENTER();

if (hw->media_type != e1000_media_type_internal_serdes)
return E1000_SUCCESS;
@@ -709,7 +711,7 @@ s32 e1000_setup_link(struct e1000_hw *hw)
s32 ret_val;
u16 eeprom_data;

- DEBUGFUNC("e1000_setup_link");
+ ENTER();

/* Read and store word 0x0F of the EEPROM. This word contains bits
* that determine the hardware's default PAUSE (flow control) mode,
@@ -723,7 +725,7 @@ s32 e1000_setup_link(struct e1000_hw *hw)
ret_val = e1000_read_eeprom(hw, EEPROM_INIT_CONTROL2_REG,
1, &eeprom_data);
if (ret_val) {
- DEBUGOUT("EEPROM Read Error\n");
+ pr_debug("EEPROM Read Error\n");
return -E1000_ERR_EEPROM;
}
if ((eeprom_data & EEPROM_WORD0F_PAUSE_MASK) == 0)
@@ -747,7 +749,7 @@ s32 e1000_setup_link(struct e1000_hw *hw)

hw->original_fc = hw->fc;

- DEBUGOUT1("After fix-ups FlowControl is now = %x\n", hw->fc);
+ pr_debug("After fix-ups FlowControl is now = %x\n", hw->fc);

/* Take the 4 bits from EEPROM word 0x0F that determine the initial
* polarity value for the SW controlled pins, and setup the
@@ -760,7 +762,7 @@ s32 e1000_setup_link(struct e1000_hw *hw)
ret_val = e1000_read_eeprom(hw, EEPROM_INIT_CONTROL2_REG,
1, &eeprom_data);
if (ret_val) {
- DEBUGOUT("EEPROM Read Error\n");
+ pr_debug("EEPROM Read Error\n");
return -E1000_ERR_EEPROM;
}
ctrl_ext = ((eeprom_data & EEPROM_WORD0F_SWPDIO_EXT) <<
@@ -777,8 +779,7 @@ s32 e1000_setup_link(struct e1000_hw *hw)
* control is disabled, because it does not hurt anything to
* initialize these registers.
*/
- DEBUGOUT
- ("Initializing the Flow Control address, type and timer regs\n");
+ pr_debug("Initializing the Flow Control address, type and timer regs\n");

ew32(FCT, FLOW_CONTROL_TYPE);
ew32(FCAH, FLOW_CONTROL_ADDRESS_HIGH);
@@ -827,7 +828,7 @@ static s32 e1000_setup_fiber_serdes_link(struct e1000_hw *hw)
u32 signal = 0;
s32 ret_val;

- DEBUGFUNC("e1000_setup_fiber_serdes_link");
+ ENTER();

/* On adapters with a MAC newer than 82544, SWDP 1 will be
* set when the optics detect a signal. On older adapters, it will be
@@ -893,7 +894,7 @@ static s32 e1000_setup_fiber_serdes_link(struct e1000_hw *hw)
txcw = (E1000_TXCW_ANE | E1000_TXCW_FD | E1000_TXCW_PAUSE_MASK);
break;
default:
- DEBUGOUT("Flow control param set incorrectly\n");
+ pr_debug("Flow control param set incorrectly\n");
return -E1000_ERR_CONFIG;
break;
}
@@ -904,7 +905,7 @@ static s32 e1000_setup_fiber_serdes_link(struct e1000_hw *hw)
* link-up status bit will be set and the flow control enable bits (RFCE
* and TFCE) will be set according to their negotiated value.
*/
- DEBUGOUT("Auto-negotiation enabled\n");
+ pr_debug("Auto-negotiation enabled\n");

ew32(TXCW, txcw);
ew32(CTRL, ctrl);
@@ -921,7 +922,7 @@ static s32 e1000_setup_fiber_serdes_link(struct e1000_hw *hw)
*/
if (hw->media_type == e1000_media_type_internal_serdes ||
(er32(CTRL) & E1000_CTRL_SWDPIN1) == signal) {
- DEBUGOUT("Looking for Link\n");
+ pr_debug("Looking for Link\n");
for (i = 0; i < (LINK_UP_TIMEOUT / 10); i++) {
msleep(10);
status = er32(STATUS);
@@ -929,7 +930,7 @@ static s32 e1000_setup_fiber_serdes_link(struct e1000_hw *hw)
break;
}
if (i == (LINK_UP_TIMEOUT / 10)) {
- DEBUGOUT("Never got a valid link from auto-neg!!!\n");
+ pr_debug("Never got a valid link from auto-neg!!!\n");
hw->autoneg_failed = 1;
/* AutoNeg failed to achieve a link, so we'll call
* e1000_check_for_link. This routine will force the link up if
@@ -938,16 +939,16 @@ static s32 e1000_setup_fiber_serdes_link(struct e1000_hw *hw)
*/
ret_val = e1000_check_for_link(hw);
if (ret_val) {
- DEBUGOUT("Error while checking for link\n");
+ pr_debug("Error while checking for link\n");
return ret_val;
}
hw->autoneg_failed = 0;
} else {
hw->autoneg_failed = 0;
- DEBUGOUT("Valid Link Found\n");
+ pr_debug("Valid Link Found\n");
}
} else {
- DEBUGOUT("No Signal Detected\n");
+ pr_debug("No Signal Detected\n");
}
return E1000_SUCCESS;
}
@@ -964,7 +965,7 @@ static s32 e1000_copper_link_preconfig(struct e1000_hw *hw)
s32 ret_val;
u16 phy_data;

- DEBUGFUNC("e1000_copper_link_preconfig");
+ ENTER();

ctrl = er32(CTRL);
/* With 82543, we need to force speed and duplex on the MAC equal to what
@@ -987,10 +988,10 @@ static s32 e1000_copper_link_preconfig(struct e1000_hw *hw)
/* Make sure we have a valid PHY */
ret_val = e1000_detect_gig_phy(hw);
if (ret_val) {
- DEBUGOUT("Error, did not detect valid phy.\n");
+ pr_debug("Error, did not detect valid phy\n");
return ret_val;
}
- DEBUGOUT1("Phy ID = %x \n", hw->phy_id);
+ pr_debug("Phy ID = %x \n", hw->phy_id);

/* Set PHY to class A mode (if necessary) */
ret_val = e1000_set_phy_mode(hw);
@@ -1025,14 +1026,14 @@ static s32 e1000_copper_link_igp_setup(struct e1000_hw *hw)
s32 ret_val;
u16 phy_data;

- DEBUGFUNC("e1000_copper_link_igp_setup");
+ ENTER();

if (hw->phy_reset_disable)
return E1000_SUCCESS;

ret_val = e1000_phy_reset(hw);
if (ret_val) {
- DEBUGOUT("Error Resetting the PHY\n");
+ pr_debug("Error Resetting the PHY\n");
return ret_val;
}

@@ -1049,7 +1050,7 @@ static s32 e1000_copper_link_igp_setup(struct e1000_hw *hw)
/* disable lplu d3 during driver init */
ret_val = e1000_set_d3_lplu_state(hw, false);
if (ret_val) {
- DEBUGOUT("Error Disabling LPLU D3\n");
+ pr_debug("Error Disabling LPLU D3\n");
return ret_val;
}
}
@@ -1166,7 +1167,7 @@ static s32 e1000_copper_link_mgp_setup(struct e1000_hw *hw)
s32 ret_val;
u16 phy_data;

- DEBUGFUNC("e1000_copper_link_mgp_setup");
+ ENTER();

if (hw->phy_reset_disable)
return E1000_SUCCESS;
@@ -1255,7 +1256,7 @@ static s32 e1000_copper_link_mgp_setup(struct e1000_hw *hw)
/* SW Reset the PHY so all changes take effect */
ret_val = e1000_phy_reset(hw);
if (ret_val) {
- DEBUGOUT("Error Resetting the PHY\n");
+ pr_debug("Error Resetting the PHY\n");
return ret_val;
}

@@ -1274,7 +1275,7 @@ static s32 e1000_copper_link_autoneg(struct e1000_hw *hw)
s32 ret_val;
u16 phy_data;

- DEBUGFUNC("e1000_copper_link_autoneg");
+ ENTER();

/* Perform some bounds checking on the hw->autoneg_advertised
* parameter. If this variable is zero, then set it to the default.
@@ -1287,13 +1288,13 @@ static s32 e1000_copper_link_autoneg(struct e1000_hw *hw)
if (hw->autoneg_advertised == 0)
hw->autoneg_advertised = AUTONEG_ADVERTISE_SPEED_DEFAULT;

- DEBUGOUT("Reconfiguring auto-neg advertisement params\n");
+ pr_debug("Reconfiguring auto-neg advertisement params\n");
ret_val = e1000_phy_setup_autoneg(hw);
if (ret_val) {
- DEBUGOUT("Error Setting up Auto-Negotiation\n");
+ pr_debug("Error Setting up Auto-Negotiation\n");
return ret_val;
}
- DEBUGOUT("Restarting Auto-Neg\n");
+ pr_debug("Restarting Auto-Neg\n");

/* Restart auto-negotiation by setting the Auto Neg Enable bit and
* the Auto Neg Restart bit in the PHY control register.
@@ -1313,8 +1314,7 @@ static s32 e1000_copper_link_autoneg(struct e1000_hw *hw)
if (hw->wait_autoneg_complete) {
ret_val = e1000_wait_autoneg(hw);
if (ret_val) {
- DEBUGOUT
- ("Error while waiting for autoneg to complete\n");
+ pr_debug("Error while waiting for autoneg to complete\n");
return ret_val;
}
}
@@ -1340,20 +1340,20 @@ static s32 e1000_copper_link_autoneg(struct e1000_hw *hw)
static s32 e1000_copper_link_postconfig(struct e1000_hw *hw)
{
s32 ret_val;
- DEBUGFUNC("e1000_copper_link_postconfig");
+ ENTER();

if (hw->mac_type >= e1000_82544) {
e1000_config_collision_dist(hw);
} else {
ret_val = e1000_config_mac_to_phy(hw);
if (ret_val) {
- DEBUGOUT("Error configuring MAC to PHY settings\n");
+ pr_debug("Error configuring MAC to PHY settings\n");
return ret_val;
}
}
ret_val = e1000_config_fc_after_link_up(hw);
if (ret_val) {
- DEBUGOUT("Error Configuring Flow Control\n");
+ pr_debug("Error Configuring Flow Control\n");
return ret_val;
}

@@ -1361,7 +1361,7 @@ static s32 e1000_copper_link_postconfig(struct e1000_hw *hw)
if (hw->phy_type == e1000_phy_igp) {
ret_val = e1000_config_dsp_after_link_change(hw, true);
if (ret_val) {
- DEBUGOUT("Error Configuring DSP after link up\n");
+ pr_debug("Error Configuring DSP after link up\n");
return ret_val;
}
}
@@ -1381,7 +1381,7 @@ static s32 e1000_setup_copper_link(struct e1000_hw *hw)
u16 i;
u16 phy_data;

- DEBUGFUNC("e1000_setup_copper_link");
+ ENTER();

/* Check if it is a valid PHY and set PHY mode if necessary. */
ret_val = e1000_copper_link_preconfig(hw);
@@ -1407,10 +1407,10 @@ static s32 e1000_setup_copper_link(struct e1000_hw *hw)
} else {
/* PHY will be set to 10H, 10F, 100H,or 100F
* depending on value from forced_speed_duplex. */
- DEBUGOUT("Forcing speed and duplex\n");
+ pr_debug("Forcing speed and duplex\n");
ret_val = e1000_phy_force_speed_duplex(hw);
if (ret_val) {
- DEBUGOUT("Error Forcing Speed and Duplex\n");
+ pr_debug("Error Forcing Speed and Duplex\n");
return ret_val;
}
}
@@ -1432,13 +1432,13 @@ static s32 e1000_setup_copper_link(struct e1000_hw *hw)
if (ret_val)
return ret_val;

- DEBUGOUT("Valid link established!!!\n");
+ pr_debug("Valid link established!!!\n");
return E1000_SUCCESS;
}
udelay(10);
}

- DEBUGOUT("Unable to establish link!!!\n");
+ pr_debug("Unable to establish link!!!\n");
return E1000_SUCCESS;
}

@@ -1454,7 +1454,7 @@ s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
u16 mii_autoneg_adv_reg;
u16 mii_1000t_ctrl_reg;

- DEBUGFUNC("e1000_phy_setup_autoneg");
+ ENTER();

/* Read the MII Auto-Neg Advertisement Register (Address 4). */
ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_ADV, &mii_autoneg_adv_reg);
@@ -1481,41 +1481,40 @@ s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
mii_autoneg_adv_reg &= ~REG4_SPEED_MASK;
mii_1000t_ctrl_reg &= ~REG9_SPEED_MASK;

- DEBUGOUT1("autoneg_advertised %x\n", hw->autoneg_advertised);
+ pr_debug("autoneg_advertised %x\n", hw->autoneg_advertised);

/* Do we want to advertise 10 Mb Half Duplex? */
if (hw->autoneg_advertised & ADVERTISE_10_HALF) {
- DEBUGOUT("Advertise 10mb Half duplex\n");
+ pr_debug("Advertise 10mb Half duplex\n");
mii_autoneg_adv_reg |= NWAY_AR_10T_HD_CAPS;
}

/* Do we want to advertise 10 Mb Full Duplex? */
if (hw->autoneg_advertised & ADVERTISE_10_FULL) {
- DEBUGOUT("Advertise 10mb Full duplex\n");
+ pr_debug("Advertise 10mb Full duplex\n");
mii_autoneg_adv_reg |= NWAY_AR_10T_FD_CAPS;
}

/* Do we want to advertise 100 Mb Half Duplex? */
if (hw->autoneg_advertised & ADVERTISE_100_HALF) {
- DEBUGOUT("Advertise 100mb Half duplex\n");
+ pr_debug("Advertise 100mb Half duplex\n");
mii_autoneg_adv_reg |= NWAY_AR_100TX_HD_CAPS;
}

/* Do we want to advertise 100 Mb Full Duplex? */
if (hw->autoneg_advertised & ADVERTISE_100_FULL) {
- DEBUGOUT("Advertise 100mb Full duplex\n");
+ pr_debug("Advertise 100mb Full duplex\n");
mii_autoneg_adv_reg |= NWAY_AR_100TX_FD_CAPS;
}

/* We do not allow the Phy to advertise 1000 Mb Half Duplex */
if (hw->autoneg_advertised & ADVERTISE_1000_HALF) {
- DEBUGOUT
- ("Advertise 1000mb Half duplex requested, request denied!\n");
+ pr_debug("Advertise 1000mb Half duplex requested, request denied!\n");
}

/* Do we want to advertise 1000 Mb Full Duplex? */
if (hw->autoneg_advertised & ADVERTISE_1000_FULL) {
- DEBUGOUT("Advertise 1000mb Full duplex\n");
+ pr_debug("Advertise 1000mb Full duplex\n");
mii_1000t_ctrl_reg |= CR_1000T_FD_CAPS;
}

@@ -1568,7 +1567,7 @@ s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE);
break;
default:
- DEBUGOUT("Flow control param set incorrectly\n");
+ pr_debug("Flow control param set incorrectly\n");
return -E1000_ERR_CONFIG;
}

@@ -1576,7 +1575,7 @@ s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
if (ret_val)
return ret_val;

- DEBUGOUT1("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg);
+ pr_debug("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg);

ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, mii_1000t_ctrl_reg);
if (ret_val)
@@ -1600,12 +1599,12 @@ static s32 e1000_phy_force_speed_duplex(struct e1000_hw *hw)
u16 phy_data;
u16 i;

- DEBUGFUNC("e1000_phy_force_speed_duplex");
+ ENTER();

/* Turn off Flow control if we are forcing speed and duplex. */
hw->fc = E1000_FC_NONE;

- DEBUGOUT1("hw->fc = %d\n", hw->fc);
+ pr_debug("hw->fc = %d\n", hw->fc);

/* Read the Device Control Register. */
ctrl = er32(CTRL);
@@ -1634,14 +1633,14 @@ static s32 e1000_phy_force_speed_duplex(struct e1000_hw *hw)
*/
ctrl |= E1000_CTRL_FD;
mii_ctrl_reg |= MII_CR_FULL_DUPLEX;
- DEBUGOUT("Full Duplex\n");
+ pr_debug("Full Duplex\n");
} else {
/* We want to force half duplex so we CLEAR the full duplex bits in
* the Device and MII Control Registers.
*/
ctrl &= ~E1000_CTRL_FD;
mii_ctrl_reg &= ~MII_CR_FULL_DUPLEX;
- DEBUGOUT("Half Duplex\n");
+ pr_debug("Half Duplex\n");
}

/* Are we forcing 100Mbps??? */
@@ -1651,13 +1650,13 @@ static s32 e1000_phy_force_speed_duplex(struct e1000_hw *hw)
ctrl |= E1000_CTRL_SPD_100;
mii_ctrl_reg |= MII_CR_SPEED_100;
mii_ctrl_reg &= ~(MII_CR_SPEED_1000 | MII_CR_SPEED_10);
- DEBUGOUT("Forcing 100mb ");
+ pr_debug("Forcing 100mb ");
} else {
/* Set the 10Mb bit and turn off the 1000Mb and 100Mb bits. */
ctrl &= ~(E1000_CTRL_SPD_1000 | E1000_CTRL_SPD_100);
mii_ctrl_reg |= MII_CR_SPEED_10;
mii_ctrl_reg &= ~(MII_CR_SPEED_1000 | MII_CR_SPEED_100);
- DEBUGOUT("Forcing 10mb ");
+ pr_debug("Forcing 10mb ");
}

e1000_config_collision_dist(hw);
@@ -1680,7 +1679,7 @@ static s32 e1000_phy_force_speed_duplex(struct e1000_hw *hw)
if (ret_val)
return ret_val;

- DEBUGOUT1("M88E1000 PSCR: %x \n", phy_data);
+ pr_debug("M88E1000 PSCR: %x\n", phy_data);

/* Need to reset the PHY or these changes will be ignored */
mii_ctrl_reg |= MII_CR_RESET;
@@ -1720,7 +1719,7 @@ static s32 e1000_phy_force_speed_duplex(struct e1000_hw *hw)
*/
if (hw->wait_autoneg_complete) {
/* We will wait for autoneg to complete. */
- DEBUGOUT("Waiting for forced speed/duplex link.\n");
+ pr_debug("Waiting for forced speed/duplex link\n");
mii_status_reg = 0;

/* We will wait for autoneg to complete or 4.5 seconds to expire. */
@@ -1746,7 +1745,7 @@ static s32 e1000_phy_force_speed_duplex(struct e1000_hw *hw)
/* We didn't get link. Reset the DSP and wait again for link. */
ret_val = e1000_phy_reset_dsp(hw);
if (ret_val) {
- DEBUGOUT("Error Resetting PHY DSP\n");
+ pr_debug("Error Resetting PHY DSP\n");
return ret_val;
}
}
@@ -1826,7 +1825,7 @@ void e1000_config_collision_dist(struct e1000_hw *hw)
{
u32 tctl, coll_dist;

- DEBUGFUNC("e1000_config_collision_dist");
+ ENTER();

if (hw->mac_type < e1000_82543)
coll_dist = E1000_COLLISION_DISTANCE_82542;
@@ -1857,7 +1856,7 @@ static s32 e1000_config_mac_to_phy(struct e1000_hw *hw)
s32 ret_val;
u16 phy_data;

- DEBUGFUNC("e1000_config_mac_to_phy");
+ ENTER();

/* 82544 or newer MAC, Auto Speed Detection takes care of
* MAC speed/duplex configuration.*/
@@ -1913,7 +1912,7 @@ s32 e1000_force_mac_fc(struct e1000_hw *hw)
{
u32 ctrl;

- DEBUGFUNC("e1000_force_mac_fc");
+ ENTER();

/* Get the current configuration of the Device Control Register */
ctrl = er32(CTRL);
@@ -1952,7 +1951,7 @@ s32 e1000_force_mac_fc(struct e1000_hw *hw)
ctrl |= (E1000_CTRL_TFCE | E1000_CTRL_RFCE);
break;
default:
- DEBUGOUT("Flow control param set incorrectly\n");
+ pr_debug("Flow control param set incorrectly\n");
return -E1000_ERR_CONFIG;
}

@@ -1984,7 +1983,7 @@ static s32 e1000_config_fc_after_link_up(struct e1000_hw *hw)
u16 speed;
u16 duplex;

- DEBUGFUNC("e1000_config_fc_after_link_up");
+ ENTER();

/* Check for the case where we have fiber media and auto-neg failed
* so we had to force link. In this case, we need to force the
@@ -1997,7 +1996,7 @@ static s32 e1000_config_fc_after_link_up(struct e1000_hw *hw)
&& (!hw->autoneg))) {
ret_val = e1000_force_mac_fc(hw);
if (ret_val) {
- DEBUGOUT("Error forcing flow control settings\n");
+ pr_debug("Error forcing flow control settings\n");
return ret_val;
}
}
@@ -2079,11 +2078,10 @@ static s32 e1000_config_fc_after_link_up(struct e1000_hw *hw)
*/
if (hw->original_fc == E1000_FC_FULL) {
hw->fc = E1000_FC_FULL;
- DEBUGOUT("Flow Control = FULL.\n");
+ pr_debug("Flow Control = FULL\n");
} else {
hw->fc = E1000_FC_RX_PAUSE;
- DEBUGOUT
- ("Flow Control = RX PAUSE frames only.\n");
+ pr_debug("Flow Control = RX PAUSE frames only\n");
}
}
/* For receiving PAUSE frames ONLY.
@@ -2100,8 +2098,7 @@ static s32 e1000_config_fc_after_link_up(struct e1000_hw *hw)
(mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR))
{
hw->fc = E1000_FC_TX_PAUSE;
- DEBUGOUT
- ("Flow Control = TX PAUSE frames only.\n");
+ pr_debug("Flow Control = TX PAUSE frames only\n");
}
/* For transmitting PAUSE frames ONLY.
*
@@ -2117,8 +2114,7 @@ static s32 e1000_config_fc_after_link_up(struct e1000_hw *hw)
(mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR))
{
hw->fc = E1000_FC_RX_PAUSE;
- DEBUGOUT
- ("Flow Control = RX PAUSE frames only.\n");
+ pr_debug("Flow Control = RX PAUSE frames only\n");
}
/* Per the IEEE spec, at this point flow control should be
* disabled. However, we want to consider that we could
@@ -2144,11 +2140,10 @@ static s32 e1000_config_fc_after_link_up(struct e1000_hw *hw)
hw->original_fc == E1000_FC_TX_PAUSE) ||
hw->fc_strict_ieee) {
hw->fc = E1000_FC_NONE;
- DEBUGOUT("Flow Control = NONE.\n");
+ pr_debug("Flow Control = NONE\n");
} else {
hw->fc = E1000_FC_RX_PAUSE;
- DEBUGOUT
- ("Flow Control = RX PAUSE frames only.\n");
+ pr_debug("Flow Control = RX PAUSE frames only\n");
}

/* Now we need to do one last check... If we auto-
@@ -2158,8 +2153,7 @@ static s32 e1000_config_fc_after_link_up(struct e1000_hw *hw)
ret_val =
e1000_get_speed_and_duplex(hw, &speed, &duplex);
if (ret_val) {
- DEBUGOUT
- ("Error getting link speed and duplex\n");
+ pr_debug("Error getting link speed and duplex\n");
return ret_val;
}

@@ -2171,13 +2165,11 @@ static s32 e1000_config_fc_after_link_up(struct e1000_hw *hw)
*/
ret_val = e1000_force_mac_fc(hw);
if (ret_val) {
- DEBUGOUT
- ("Error forcing flow control settings\n");
+ pr_debug("Error forcing flow control settings\n");
return ret_val;
}
} else {
- DEBUGOUT
- ("Copper PHY and Auto Neg has not completed.\n");
+ pr_debug("Copper PHY and Auto Neg has not completed\n");
}
}
return E1000_SUCCESS;
@@ -2197,7 +2189,7 @@ static s32 e1000_check_for_serdes_link_generic(struct e1000_hw *hw)
u32 status;
s32 ret_val = E1000_SUCCESS;

- DEBUGFUNC("e1000_check_for_serdes_link_generic");
+ ENTER();

ctrl = er32(CTRL);
status = er32(STATUS);
@@ -2216,7 +2208,7 @@ static s32 e1000_check_for_serdes_link_generic(struct e1000_hw *hw)
hw->autoneg_failed = 1;
goto out;
}
- DEBUGOUT("NOT RXing /C/, disable AutoNeg and force link.\n");
+ pr_debug("NOT RXing /C/, disable AutoNeg and force link\n");

/* Disable auto-negotiation in the TXCW register */
ew32(TXCW, (hw->txcw & ~E1000_TXCW_ANE));
@@ -2229,7 +2221,7 @@ static s32 e1000_check_for_serdes_link_generic(struct e1000_hw *hw)
/* Configure Flow Control after forcing link up. */
ret_val = e1000_config_fc_after_link_up(hw);
if (ret_val) {
- DEBUGOUT("Error configuring flow control\n");
+ pr_debug("Error configuring flow control\n");
goto out;
}
} else if ((ctrl & E1000_CTRL_SLU) && (rxcw & E1000_RXCW_C)) {
@@ -2239,7 +2231,7 @@ static s32 e1000_check_for_serdes_link_generic(struct e1000_hw *hw)
* and disable forced link in the Device Control register
* in an attempt to auto-negotiate with our link partner.
*/
- DEBUGOUT("RXing /C/, enable AutoNeg and stop forcing link.\n");
+ pr_debug("RXing /C/, enable AutoNeg and stop forcing link\n");
ew32(TXCW, hw->txcw);
ew32(CTRL, (ctrl & ~E1000_CTRL_SLU));

@@ -2256,11 +2248,11 @@ static s32 e1000_check_for_serdes_link_generic(struct e1000_hw *hw)
if (rxcw & E1000_RXCW_SYNCH) {
if (!(rxcw & E1000_RXCW_IV)) {
hw->serdes_has_link = true;
- DEBUGOUT("SERDES: Link up - forced.\n");
+ pr_debug("SERDES: Link up - forced\n");
}
} else {
hw->serdes_has_link = false;
- DEBUGOUT("SERDES: Link down - force failed.\n");
+ pr_debug("SERDES: Link down - force failed\n");
}
}

@@ -2273,20 +2265,18 @@ static s32 e1000_check_for_serdes_link_generic(struct e1000_hw *hw)
if (rxcw & E1000_RXCW_SYNCH) {
if (!(rxcw & E1000_RXCW_IV)) {
hw->serdes_has_link = true;
- DEBUGOUT("SERDES: Link up - autoneg "
- "completed successfully.\n");
+ pr_debug("SERDES: Link up - autoneg completed successfully\n");
} else {
hw->serdes_has_link = false;
- DEBUGOUT("SERDES: Link down - invalid"
- "codewords detected in autoneg.\n");
+ pr_debug("SERDES: Link down - invalidcodewords detected in autoneg\n");
}
} else {
hw->serdes_has_link = false;
- DEBUGOUT("SERDES: Link down - no sync.\n");
+ pr_debug("SERDES: Link down - no sync\n");
}
} else {
hw->serdes_has_link = false;
- DEBUGOUT("SERDES: Link down - autoneg failed\n");
+ pr_debug("SERDES: Link down - autoneg failed\n");
}
}

@@ -2312,7 +2302,7 @@ s32 e1000_check_for_link(struct e1000_hw *hw)
s32 ret_val;
u16 phy_data;

- DEBUGFUNC("e1000_check_for_link");
+ ENTER();

ctrl = er32(CTRL);
status = er32(STATUS);
@@ -2407,8 +2397,7 @@ s32 e1000_check_for_link(struct e1000_hw *hw)
else {
ret_val = e1000_config_mac_to_phy(hw);
if (ret_val) {
- DEBUGOUT
- ("Error configuring MAC to PHY settings\n");
+ pr_debug("Error configuring MAC to PHY settings\n");
return ret_val;
}
}
@@ -2419,7 +2408,7 @@ s32 e1000_check_for_link(struct e1000_hw *hw)
*/
ret_val = e1000_config_fc_after_link_up(hw);
if (ret_val) {
- DEBUGOUT("Error configuring flow control\n");
+ pr_debug("Error configuring flow control\n");
return ret_val;
}

@@ -2435,8 +2424,7 @@ s32 e1000_check_for_link(struct e1000_hw *hw)
ret_val =
e1000_get_speed_and_duplex(hw, &speed, &duplex);
if (ret_val) {
- DEBUGOUT
- ("Error getting link speed and duplex\n");
+ pr_debug("Error getting link speed and duplex\n");
return ret_val;
}
if (speed != SPEED_1000) {
@@ -2487,33 +2475,29 @@ s32 e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, u16 *duplex)
s32 ret_val;
u16 phy_data;

- DEBUGFUNC("e1000_get_speed_and_duplex");
+ ENTER();

if (hw->mac_type >= e1000_82543) {
status = er32(STATUS);
- if (status & E1000_STATUS_SPEED_1000) {
+ if (status & E1000_STATUS_SPEED_1000)
*speed = SPEED_1000;
- DEBUGOUT("1000 Mbs, ");
- } else if (status & E1000_STATUS_SPEED_100) {
+ else if (status & E1000_STATUS_SPEED_100)
*speed = SPEED_100;
- DEBUGOUT("100 Mbs, ");
- } else {
+ else
*speed = SPEED_10;
- DEBUGOUT("10 Mbs, ");
- }

- if (status & E1000_STATUS_FD) {
+ if (status & E1000_STATUS_FD)
*duplex = FULL_DUPLEX;
- DEBUGOUT("Full Duplex\n");
- } else {
+ else
*duplex = HALF_DUPLEX;
- DEBUGOUT(" Half Duplex\n");
- }
} else {
- DEBUGOUT("1000 Mbs, Full Duplex\n");
*speed = SPEED_1000;
*duplex = FULL_DUPLEX;
}
+ pr_debug("%u Mbps, %s Duplex\n",
+ (*speed == SPEED_1000) ? 1000 :
+ (*speed == SPEED_100) ? 100: 10,
+ (*duplex == FULL_DUPLEX) ? "Full" : "Half");

/* IGP01 PHY may advertise full duplex operation after speed downgrade even
* if it is operating at half duplex. Here we set the duplex settings to
@@ -2554,8 +2538,8 @@ static s32 e1000_wait_autoneg(struct e1000_hw *hw)
u16 i;
u16 phy_data;

- DEBUGFUNC("e1000_wait_autoneg");
- DEBUGOUT("Waiting for Auto-Neg to complete.\n");
+ ENTER();
+ pr_debug("Waiting for Auto-Neg to complete\n");

/* We will wait for autoneg to complete or 4.5 seconds to expire. */
for (i = PHY_AUTO_NEG_TIME; i > 0; i--) {
@@ -2718,7 +2702,7 @@ s32 e1000_read_phy_reg(struct e1000_hw *hw, u32 reg_addr, u16 *phy_data)
{
u32 ret_val;

- DEBUGFUNC("e1000_read_phy_reg");
+ ENTER();

if ((hw->phy_type == e1000_phy_igp) &&
(reg_addr > MAX_PHY_MULTI_PAGE_REG)) {
@@ -2741,10 +2725,10 @@ static s32 e1000_read_phy_reg_ex(struct e1000_hw *hw, u32 reg_addr,
u32 mdic = 0;
const u32 phy_addr = 1;

- DEBUGFUNC("e1000_read_phy_reg_ex");
+ ENTER();

if (reg_addr > MAX_PHY_REG_ADDRESS) {
- DEBUGOUT1("PHY Address %d is out of range\n", reg_addr);
+ pr_debug("PHY Address %d is out of range\n", reg_addr);
return -E1000_ERR_PARAM;
}

@@ -2767,11 +2751,11 @@ static s32 e1000_read_phy_reg_ex(struct e1000_hw *hw, u32 reg_addr,
break;
}
if (!(mdic & E1000_MDIC_READY)) {
- DEBUGOUT("MDI Read did not complete\n");
+ pr_debug("MDI Read did not complete\n");
return -E1000_ERR_PHY;
}
if (mdic & E1000_MDIC_ERROR) {
- DEBUGOUT("MDI Error\n");
+ pr_debug("MDI Error\n");
return -E1000_ERR_PHY;
}
*phy_data = (u16) mdic;
@@ -2820,7 +2804,7 @@ s32 e1000_write_phy_reg(struct e1000_hw *hw, u32 reg_addr, u16 phy_data)
{
u32 ret_val;

- DEBUGFUNC("e1000_write_phy_reg");
+ ENTER();

if ((hw->phy_type == e1000_phy_igp) &&
(reg_addr > MAX_PHY_MULTI_PAGE_REG)) {
@@ -2843,10 +2827,10 @@ static s32 e1000_write_phy_reg_ex(struct e1000_hw *hw, u32 reg_addr,
u32 mdic = 0;
const u32 phy_addr = 1;

- DEBUGFUNC("e1000_write_phy_reg_ex");
+ ENTER();

if (reg_addr > MAX_PHY_REG_ADDRESS) {
- DEBUGOUT1("PHY Address %d is out of range\n", reg_addr);
+ pr_debug("PHY Address %d is out of range\n", reg_addr);
return -E1000_ERR_PARAM;
}

@@ -2870,7 +2854,7 @@ static s32 e1000_write_phy_reg_ex(struct e1000_hw *hw, u32 reg_addr,
break;
}
if (!(mdic & E1000_MDIC_READY)) {
- DEBUGOUT("MDI Write did not complete\n");
+ pr_debug("MDI Write did not complete\n");
return -E1000_ERR_PHY;
}
} else {
@@ -2910,9 +2894,9 @@ s32 e1000_phy_hw_reset(struct e1000_hw *hw)
u32 led_ctrl;
s32 ret_val;

- DEBUGFUNC("e1000_phy_hw_reset");
+ ENTER();

- DEBUGOUT("Resetting Phy...\n");
+ pr_debug("Resetting Phy...\n");

if (hw->mac_type > e1000_82543) {
/* Read the device control register and assert the E1000_CTRL_PHY_RST
@@ -2973,7 +2957,7 @@ s32 e1000_phy_reset(struct e1000_hw *hw)
s32 ret_val;
u16 phy_data;

- DEBUGFUNC("e1000_phy_reset");
+ ENTER();

switch (hw->phy_type) {
case e1000_phy_igp:
@@ -3013,7 +2997,7 @@ static s32 e1000_detect_gig_phy(struct e1000_hw *hw)
u16 phy_id_high, phy_id_low;
bool match = false;

- DEBUGFUNC("e1000_detect_gig_phy");
+ ENTER();

if (hw->phy_id != 0)
return E1000_SUCCESS;
@@ -3057,16 +3041,16 @@ static s32 e1000_detect_gig_phy(struct e1000_hw *hw)
match = true;
break;
default:
- DEBUGOUT1("Invalid MAC type %d\n", hw->mac_type);
+ pr_debug("Invalid MAC type %d\n", hw->mac_type);
return -E1000_ERR_CONFIG;
}
phy_init_status = e1000_set_phy_type(hw);

if ((match) && (phy_init_status == E1000_SUCCESS)) {
- DEBUGOUT1("PHY ID 0x%X detected\n", hw->phy_id);
+ pr_debug("PHY ID 0x%X detected\n", hw->phy_id);
return E1000_SUCCESS;
}
- DEBUGOUT1("Invalid PHY ID 0x%X\n", hw->phy_id);
+ pr_debug("Invalid PHY ID 0x%X\n", hw->phy_id);
return -E1000_ERR_PHY;
}

@@ -3079,7 +3063,7 @@ static s32 e1000_detect_gig_phy(struct e1000_hw *hw)
static s32 e1000_phy_reset_dsp(struct e1000_hw *hw)
{
s32 ret_val;
- DEBUGFUNC("e1000_phy_reset_dsp");
+ ENTER();

do {
ret_val = e1000_write_phy_reg(hw, 29, 0x001d);
@@ -3111,7 +3095,7 @@ static s32 e1000_phy_igp_get_info(struct e1000_hw *hw,
u16 phy_data, min_length, max_length, average;
e1000_rev_polarity polarity;

- DEBUGFUNC("e1000_phy_igp_get_info");
+ ENTER();

/* The downshift status is checked only once, after link is established,
* and it stored in the hw->speed_downgraded parameter. */
@@ -3189,7 +3173,7 @@ static s32 e1000_phy_m88_get_info(struct e1000_hw *hw,
u16 phy_data;
e1000_rev_polarity polarity;

- DEBUGFUNC("e1000_phy_m88_get_info");
+ ENTER();

/* The downshift status is checked only once, after link is established,
* and it stored in the hw->speed_downgraded parameter. */
@@ -3261,7 +3245,7 @@ s32 e1000_phy_get_info(struct e1000_hw *hw, struct e1000_phy_info *phy_info)
s32 ret_val;
u16 phy_data;

- DEBUGFUNC("e1000_phy_get_info");
+ ENTER();

phy_info->cable_length = e1000_cable_length_undefined;
phy_info->extended_10bt_distance = e1000_10bt_ext_dist_enable_undefined;
@@ -3273,7 +3257,7 @@ s32 e1000_phy_get_info(struct e1000_hw *hw, struct e1000_phy_info *phy_info)
phy_info->remote_rx = e1000_1000t_rx_status_undefined;

if (hw->media_type != e1000_media_type_copper) {
- DEBUGOUT("PHY info is only valid for copper media\n");
+ pr_debug("PHY info is only valid for copper media\n");
return -E1000_ERR_CONFIG;
}

@@ -3286,7 +3270,7 @@ s32 e1000_phy_get_info(struct e1000_hw *hw, struct e1000_phy_info *phy_info)
return ret_val;

if ((phy_data & MII_SR_LINK_STATUS) != MII_SR_LINK_STATUS) {
- DEBUGOUT("PHY info is only valid if link is up\n");
+ pr_debug("PHY info is only valid if link is up\n");
return -E1000_ERR_CONFIG;
}

@@ -3298,10 +3282,10 @@ s32 e1000_phy_get_info(struct e1000_hw *hw, struct e1000_phy_info *phy_info)

s32 e1000_validate_mdi_setting(struct e1000_hw *hw)
{
- DEBUGFUNC("e1000_validate_mdi_settings");
+ ENTER();

if (!hw->autoneg && (hw->mdix == 0 || hw->mdix == 3)) {
- DEBUGOUT("Invalid MDI setting detected\n");
+ pr_debug("Invalid MDI setting detected\n");
hw->mdix = 1;
return -E1000_ERR_CONFIG;
}
@@ -3322,7 +3306,7 @@ s32 e1000_init_eeprom_params(struct e1000_hw *hw)
s32 ret_val = E1000_SUCCESS;
u16 eeprom_size;

- DEBUGFUNC("e1000_init_eeprom_params");
+ ENTER();

switch (hw->mac_type) {
case e1000_82542_rev2_0:
@@ -3539,7 +3523,7 @@ static s32 e1000_acquire_eeprom(struct e1000_hw *hw)
struct e1000_eeprom_info *eeprom = &hw->eeprom;
u32 eecd, i = 0;

- DEBUGFUNC("e1000_acquire_eeprom");
+ ENTER();

eecd = er32(EECD);

@@ -3557,7 +3541,7 @@ static s32 e1000_acquire_eeprom(struct e1000_hw *hw)
if (!(eecd & E1000_EECD_GNT)) {
eecd &= ~E1000_EECD_REQ;
ew32(EECD, eecd);
- DEBUGOUT("Could not acquire EEPROM grant\n");
+ pr_debug("Could not acquire EEPROM grant\n");
return -E1000_ERR_EEPROM;
}
}
@@ -3639,7 +3623,7 @@ static void e1000_release_eeprom(struct e1000_hw *hw)
{
u32 eecd;

- DEBUGFUNC("e1000_release_eeprom");
+ ENTER();

eecd = er32(EECD);

@@ -3687,7 +3671,7 @@ static s32 e1000_spi_eeprom_ready(struct e1000_hw *hw)
u16 retry_count = 0;
u8 spi_stat_reg;

- DEBUGFUNC("e1000_spi_eeprom_ready");
+ ENTER();

/* Read "Status Register" repeatedly until the LSB is cleared. The
* EEPROM will signal that the command has been completed by clearing
@@ -3712,7 +3696,7 @@ static s32 e1000_spi_eeprom_ready(struct e1000_hw *hw)
* only 0-5mSec on 5V devices)
*/
if (retry_count >= EEPROM_MAX_RETRY_SPI) {
- DEBUGOUT("SPI EEPROM Status error\n");
+ pr_debug("SPI EEPROM Status error\n");
return -E1000_ERR_EEPROM;
}

@@ -3741,7 +3725,7 @@ static s32 e1000_do_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words,
struct e1000_eeprom_info *eeprom = &hw->eeprom;
u32 i = 0;

- DEBUGFUNC("e1000_read_eeprom");
+ ENTER();

/* If eeprom is not yet detected, do so now */
if (eeprom->word_size == 0)
@@ -3750,11 +3734,10 @@ static s32 e1000_do_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words,
/* A check for invalid values: offset too large, too many words, and not
* enough words.
*/
- if ((offset >= eeprom->word_size)
- || (words > eeprom->word_size - offset) || (words == 0)) {
- DEBUGOUT2
- ("\"words\" parameter out of bounds. Words = %d, size = %d\n",
- offset, eeprom->word_size);
+ if ((offset >= eeprom->word_size) ||
+ (words > eeprom->word_size - offset) || (words == 0)) {
+ pr_debug("\"words\" parameter out of bounds. Words = %d, size = %d\n",
+ offset, eeprom->word_size);
return -E1000_ERR_EEPROM;
}

@@ -3832,11 +3815,11 @@ s32 e1000_validate_eeprom_checksum(struct e1000_hw *hw)
u16 checksum = 0;
u16 i, eeprom_data;

- DEBUGFUNC("e1000_validate_eeprom_checksum");
+ ENTER();

for (i = 0; i < (EEPROM_CHECKSUM_REG + 1); i++) {
if (e1000_read_eeprom(hw, i, 1, &eeprom_data) < 0) {
- DEBUGOUT("EEPROM Read Error\n");
+ pr_debug("EEPROM Read Error\n");
return -E1000_ERR_EEPROM;
}
checksum += eeprom_data;
@@ -3845,7 +3828,7 @@ s32 e1000_validate_eeprom_checksum(struct e1000_hw *hw)
if (checksum == (u16) EEPROM_SUM)
return E1000_SUCCESS;
else {
- DEBUGOUT("EEPROM Checksum Invalid\n");
+ pr_debug("EEPROM Checksum Invalid\n");
return -E1000_ERR_EEPROM;
}
}
@@ -3862,18 +3845,18 @@ s32 e1000_update_eeprom_checksum(struct e1000_hw *hw)
u16 checksum = 0;
u16 i, eeprom_data;

- DEBUGFUNC("e1000_update_eeprom_checksum");
+ ENTER();

for (i = 0; i < EEPROM_CHECKSUM_REG; i++) {
if (e1000_read_eeprom(hw, i, 1, &eeprom_data) < 0) {
- DEBUGOUT("EEPROM Read Error\n");
+ pr_debug("EEPROM Read Error\n");
return -E1000_ERR_EEPROM;
}
checksum += eeprom_data;
}
checksum = (u16) EEPROM_SUM - checksum;
if (e1000_write_eeprom(hw, EEPROM_CHECKSUM_REG, 1, &checksum) < 0) {
- DEBUGOUT("EEPROM Write Error\n");
+ pr_debug("EEPROM Write Error\n");
return -E1000_ERR_EEPROM;
}
return E1000_SUCCESS;
@@ -3904,7 +3887,7 @@ static s32 e1000_do_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words,
struct e1000_eeprom_info *eeprom = &hw->eeprom;
s32 status = 0;

- DEBUGFUNC("e1000_write_eeprom");
+ ENTER();

/* If eeprom is not yet detected, do so now */
if (eeprom->word_size == 0)
@@ -3915,7 +3898,7 @@ static s32 e1000_do_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words,
*/
if ((offset >= eeprom->word_size)
|| (words > eeprom->word_size - offset) || (words == 0)) {
- DEBUGOUT("\"words\" parameter out of bounds\n");
+ pr_debug("\"words\" parameter out of bounds\n");
return -E1000_ERR_EEPROM;
}

@@ -3949,7 +3932,7 @@ static s32 e1000_write_eeprom_spi(struct e1000_hw *hw, u16 offset, u16 words,
struct e1000_eeprom_info *eeprom = &hw->eeprom;
u16 widx = 0;

- DEBUGFUNC("e1000_write_eeprom_spi");
+ ENTER();

while (widx < words) {
u8 write_opcode = EEPROM_WRITE_OPCODE_SPI;
@@ -4013,7 +3996,7 @@ static s32 e1000_write_eeprom_microwire(struct e1000_hw *hw, u16 offset,
u16 words_written = 0;
u16 i = 0;

- DEBUGFUNC("e1000_write_eeprom_microwire");
+ ENTER();

/* Send the write enable command to the EEPROM (3-bit opcode plus
* 6/8-bit dummy address beginning with 11). It's less work to include
@@ -4056,7 +4039,7 @@ static s32 e1000_write_eeprom_microwire(struct e1000_hw *hw, u16 offset,
udelay(50);
}
if (i == 200) {
- DEBUGOUT("EEPROM Write did not complete\n");
+ pr_debug("EEPROM Write did not complete\n");
return -E1000_ERR_EEPROM;
}

@@ -4092,12 +4075,12 @@ s32 e1000_read_mac_addr(struct e1000_hw *hw)
u16 offset;
u16 eeprom_data, i;

- DEBUGFUNC("e1000_read_mac_addr");
+ ENTER();

for (i = 0; i < NODE_ADDRESS_SIZE; i += 2) {
offset = i >> 1;
if (e1000_read_eeprom(hw, offset, 1, &eeprom_data) < 0) {
- DEBUGOUT("EEPROM Read Error\n");
+ pr_debug("EEPROM Read Error\n");
return -E1000_ERR_EEPROM;
}
hw->perm_mac_addr[i] = (u8) (eeprom_data & 0x00FF);
@@ -4132,17 +4115,17 @@ static void e1000_init_rx_addrs(struct e1000_hw *hw)
u32 i;
u32 rar_num;

- DEBUGFUNC("e1000_init_rx_addrs");
+ ENTER();

/* Setup the receive address. */
- DEBUGOUT("Programming MAC Address into RAR[0]\n");
+ pr_debug("Programming MAC Address into RAR[0]\n");

e1000_rar_set(hw, hw->mac_addr, 0);

rar_num = E1000_RAR_ENTRIES;

/* Zero out the other 15 receive addresses. */
- DEBUGOUT("Clearing RAR[1-15]\n");
+ pr_debug("Clearing RAR[1-15]\n");
for (i = 1; i < rar_num; i++) {
E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0);
E1000_WRITE_FLUSH();
@@ -4290,7 +4273,7 @@ static s32 e1000_id_led_init(struct e1000_hw *hw)
u16 eeprom_data, i, temp;
const u16 led_mask = 0x0F;

- DEBUGFUNC("e1000_id_led_init");
+ ENTER();

if (hw->mac_type < e1000_82540) {
/* Nothing to do */
@@ -4303,7 +4286,7 @@ static s32 e1000_id_led_init(struct e1000_hw *hw)
hw->ledctl_mode2 = hw->ledctl_default;

if (e1000_read_eeprom(hw, EEPROM_ID_LED_SETTINGS, 1, &eeprom_data) < 0) {
- DEBUGOUT("EEPROM Read Error\n");
+ pr_debug("EEPROM Read Error\n");
return -E1000_ERR_EEPROM;
}

@@ -4363,7 +4346,7 @@ s32 e1000_setup_led(struct e1000_hw *hw)
u32 ledctl;
s32 ret_val = E1000_SUCCESS;

- DEBUGFUNC("e1000_setup_led");
+ ENTER();

switch (hw->mac_type) {
case e1000_82542_rev2_0:
@@ -4415,7 +4398,7 @@ s32 e1000_cleanup_led(struct e1000_hw *hw)
{
s32 ret_val = E1000_SUCCESS;

- DEBUGFUNC("e1000_cleanup_led");
+ ENTER();

switch (hw->mac_type) {
case e1000_82542_rev2_0:
@@ -4451,7 +4434,7 @@ s32 e1000_led_on(struct e1000_hw *hw)
{
u32 ctrl = er32(CTRL);

- DEBUGFUNC("e1000_led_on");
+ ENTER();

switch (hw->mac_type) {
case e1000_82542_rev2_0:
@@ -4497,7 +4480,7 @@ s32 e1000_led_off(struct e1000_hw *hw)
{
u32 ctrl = er32(CTRL);

- DEBUGFUNC("e1000_led_off");
+ ENTER();

switch (hw->mac_type) {
case e1000_82542_rev2_0:
@@ -4626,7 +4609,7 @@ static void e1000_clear_hw_cntrs(struct e1000_hw *hw)
*/
void e1000_reset_adaptive(struct e1000_hw *hw)
{
- DEBUGFUNC("e1000_reset_adaptive");
+ ENTER();

if (hw->adaptive_ifs) {
if (!hw->ifs_params_forced) {
@@ -4639,7 +4622,7 @@ void e1000_reset_adaptive(struct e1000_hw *hw)
hw->in_ifs_mode = false;
ew32(AIT, 0);
} else {
- DEBUGOUT("Not in Adaptive IFS mode!\n");
+ pr_debug("Not in Adaptive IFS mode!\n");
}
}

@@ -4654,7 +4637,7 @@ void e1000_reset_adaptive(struct e1000_hw *hw)
*/
void e1000_update_adaptive(struct e1000_hw *hw)
{
- DEBUGFUNC("e1000_update_adaptive");
+ ENTER();

if (hw->adaptive_ifs) {
if ((hw->collision_delta *hw->ifs_ratio) > hw->tx_packet_delta) {
@@ -4679,7 +4662,7 @@ void e1000_update_adaptive(struct e1000_hw *hw)
}
}
} else {
- DEBUGOUT("Not in Adaptive IFS mode!\n");
+ pr_debug("Not in Adaptive IFS mode!\n");
}
}

@@ -4851,7 +4834,7 @@ static s32 e1000_get_cable_length(struct e1000_hw *hw, u16 *min_length,
u16 i, phy_data;
u16 cable_length;

- DEBUGFUNC("e1000_get_cable_length");
+ ENTER();

*min_length = *max_length = 0;

@@ -4968,7 +4951,7 @@ static s32 e1000_check_polarity(struct e1000_hw *hw,
s32 ret_val;
u16 phy_data;

- DEBUGFUNC("e1000_check_polarity");
+ ENTER();

if (hw->phy_type == e1000_phy_m88) {
/* return the Polarity bit in the Status register. */
@@ -5034,7 +5017,7 @@ static s32 e1000_check_downshift(struct e1000_hw *hw)
s32 ret_val;
u16 phy_data;

- DEBUGFUNC("e1000_check_downshift");
+ ENTER();

if (hw->phy_type == e1000_phy_igp) {
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_LINK_HEALTH,
@@ -5081,7 +5064,7 @@ static s32 e1000_config_dsp_after_link_change(struct e1000_hw *hw, bool link_up)
};
u16 min_length, max_length;

- DEBUGFUNC("e1000_config_dsp_after_link_change");
+ ENTER();

if (hw->phy_type != e1000_phy_igp)
return E1000_SUCCESS;
@@ -5089,7 +5072,7 @@ static s32 e1000_config_dsp_after_link_change(struct e1000_hw *hw, bool link_up)
if (link_up) {
ret_val = e1000_get_speed_and_duplex(hw, &speed, &duplex);
if (ret_val) {
- DEBUGOUT("Error getting link speed and duplex\n");
+ pr_debug("Error getting link speed and duplex\n");
return ret_val;
}

@@ -5289,7 +5272,7 @@ static s32 e1000_set_phy_mode(struct e1000_hw *hw)
s32 ret_val;
u16 eeprom_data;

- DEBUGFUNC("e1000_set_phy_mode");
+ ENTER();

if ((hw->mac_type == e1000_82545_rev_3) &&
(hw->media_type == e1000_media_type_copper)) {
@@ -5337,7 +5320,7 @@ static s32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active)
{
s32 ret_val;
u16 phy_data;
- DEBUGFUNC("e1000_set_d3_lplu_state");
+ ENTER();

if (hw->phy_type != e1000_phy_igp)
return E1000_SUCCESS;
@@ -5440,7 +5423,7 @@ static s32 e1000_set_vco_speed(struct e1000_hw *hw)
u16 default_page = 0;
u16 phy_data;

- DEBUGFUNC("e1000_set_vco_speed");
+ ENTER();

switch (hw->mac_type) {
case e1000_82545_rev_3:
@@ -5613,7 +5596,7 @@ static s32 e1000_polarity_reversal_workaround(struct e1000_hw *hw)
*/
static s32 e1000_get_auto_rd_done(struct e1000_hw *hw)
{
- DEBUGFUNC("e1000_get_auto_rd_done");
+ ENTER();
msleep(5);
return E1000_SUCCESS;
}
@@ -5628,7 +5611,7 @@ static s32 e1000_get_auto_rd_done(struct e1000_hw *hw)
*/
static s32 e1000_get_phy_cfg_done(struct e1000_hw *hw)
{
- DEBUGFUNC("e1000_get_phy_cfg_done");
+ ENTER();
mdelay(10);
return E1000_SUCCESS;
}
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 3b14dd7..ebbcc58 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -26,6 +26,8 @@

*******************************************************************************/

+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include "e1000.h"
#include <net/ip6_checksum.h>

@@ -223,18 +225,17 @@ MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
static int __init e1000_init_module(void)
{
int ret;
- printk(KERN_INFO "%s - version %s\n",
+ pr_info("%s - version %s\n",
e1000_driver_string, e1000_driver_version);
-
- printk(KERN_INFO "%s\n", e1000_copyright);
+ pr_info("%s\n", e1000_copyright);

ret = pci_register_driver(&e1000_driver);
if (copybreak != COPYBREAK_DEFAULT) {
if (copybreak == 0)
- printk(KERN_INFO "e1000: copybreak disabled\n");
+ pr_info("copybreak disabled\n");
else
- printk(KERN_INFO "e1000: copybreak enabled for "
- "packets <= %u bytes\n", copybreak);
+ pr_info("copybreak enabled for packets <= %u bytes\n",
+ copybreak);
}
return ret;
}
@@ -265,8 +266,8 @@ static int e1000_request_irq(struct e1000_adapter *adapter)
err = request_irq(adapter->pdev->irq, handler, irq_flags, netdev->name,
netdev);
if (err) {
- DPRINTK(PROBE, ERR,
- "Unable to allocate interrupt Error: %d\n", err);
+ netif_err(adapter, probe, adapter->netdev,
+ "Unable to allocate interrupt Error: %d\n", err);
}

return err;
@@ -651,7 +652,7 @@ void e1000_reset(struct e1000_adapter *adapter)
ew32(WUC, 0);

if (e1000_init_hw(hw))
- DPRINTK(PROBE, ERR, "Hardware Error\n");
+ netif_err(adapter, probe, adapter->netdev, "Hardware Error\n");
e1000_update_mng_vlan(adapter);

/* if (adapter->hwflags & HWFLAGS_PHY_PWR_BIT) { */
@@ -692,8 +693,7 @@ static void e1000_dump_eeprom(struct e1000_adapter *adapter)

data = kmalloc(eeprom.len, GFP_KERNEL);
if (!data) {
- printk(KERN_ERR "Unable to allocate memory to dump EEPROM"
- " data\n");
+ pr_err("Unable to allocate memory to dump EEPROM data\n");
return;
}

@@ -705,30 +705,24 @@ static void e1000_dump_eeprom(struct e1000_adapter *adapter)
csum_new += data[i] + (data[i + 1] << 8);
csum_new = EEPROM_SUM - csum_new;

- printk(KERN_ERR "/*********************/\n");
- printk(KERN_ERR "Current EEPROM Checksum : 0x%04x\n", csum_old);
- printk(KERN_ERR "Calculated : 0x%04x\n", csum_new);
+ pr_err("/*********************/\n");
+ pr_err("Current EEPROM Checksum : 0x%04x\n", csum_old);
+ pr_err("Calculated : 0x%04x\n", csum_new);

- printk(KERN_ERR "Offset Values\n");
- printk(KERN_ERR "======== ======\n");
+ pr_err("Offset Values\n");
+ pr_err("======== ======\n");
print_hex_dump(KERN_ERR, "", DUMP_PREFIX_OFFSET, 16, 1, data, 128, 0);

- printk(KERN_ERR "Include this output when contacting your support "
- "provider.\n");
- printk(KERN_ERR "This is not a software error! Something bad "
- "happened to your hardware or\n");
- printk(KERN_ERR "EEPROM image. Ignoring this "
- "problem could result in further problems,\n");
- printk(KERN_ERR "possibly loss of data, corruption or system hangs!\n");
- printk(KERN_ERR "The MAC Address will be reset to 00:00:00:00:00:00, "
- "which is invalid\n");
- printk(KERN_ERR "and requires you to set the proper MAC "
- "address manually before continuing\n");
- printk(KERN_ERR "to enable this network device.\n");
- printk(KERN_ERR "Please inspect the EEPROM dump and report the issue "
- "to your hardware vendor\n");
- printk(KERN_ERR "or Intel Customer Support.\n");
- printk(KERN_ERR "/*********************/\n");
+ pr_err("Include this output when contacting your support provider.\n");
+ pr_err("This is not a software error! Something bad happened to your hardware or\n");
+ pr_err("EEPROM image. Ignoring this problem could result in further problems,\n");
+ pr_err("possibly loss of data, corruption or system hangs!\n");
+ pr_err("The MAC Address will be reset to 00:00:00:00:00:00, which is invalid\n");
+ pr_err("and requires you to set the proper MAC address manually before continuing\n");
+ pr_err("to enable this network device.\n");
+ pr_err("Please inspect the EEPROM dump and report the issue to your hardware vendor\n");
+ pr_err("or Intel Customer Support.\n");
+ pr_err("/*********************/\n");

kfree(data);
}
@@ -834,8 +828,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
if (err) {
err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
if (err) {
- E1000_ERR("No usable DMA configuration, "
- "aborting\n");
+ pr_err("No usable DMA configuration, aborting\n");
goto err_dma;
}
}
@@ -925,7 +918,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,

/* initialize eeprom parameters */
if (e1000_init_eeprom_params(hw)) {
- E1000_ERR("EEPROM initialization failed\n");
+ pr_err("EEPROM initialization failed\n");
goto err_eeprom;
}

@@ -936,7 +929,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev,

/* make sure the EEPROM is good */
if (e1000_validate_eeprom_checksum(hw) < 0) {
- DPRINTK(PROBE, ERR, "The EEPROM Checksum Is Not Valid\n");
+ netif_err(adapter, probe, adapter->netdev,
+ "The EEPROM Checksum Is Not Valid\n");
e1000_dump_eeprom(adapter);
/*
* set MAC address to all zeroes to invalidate and temporary
@@ -950,14 +944,16 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
} else {
/* copy the MAC address out of the EEPROM */
if (e1000_read_mac_addr(hw))
- DPRINTK(PROBE, ERR, "EEPROM Read Error\n");
+ netif_err(adapter, probe, adapter->netdev,
+ "EEPROM Read Error\n");
}
/* don't block initalization here due to bad MAC address */
memcpy(netdev->dev_addr, hw->mac_addr, netdev->addr_len);
memcpy(netdev->perm_addr, hw->mac_addr, netdev->addr_len);

if (!is_valid_ether_addr(netdev->perm_addr))
- DPRINTK(PROBE, ERR, "Invalid MAC Address\n");
+ netif_err(adapter, probe, adapter->netdev,
+ "Invalid MAC Address\n");

e1000_get_bus_info(hw);

@@ -1039,15 +1035,14 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol);

/* print bus type/speed/width info */
- DPRINTK(PROBE, INFO, "(PCI%s:%s:%s) ",
- ((hw->bus_type == e1000_bus_type_pcix) ? "-X" : ""),
- ((hw->bus_speed == e1000_bus_speed_133) ? "133MHz" :
- (hw->bus_speed == e1000_bus_speed_120) ? "120MHz" :
- (hw->bus_speed == e1000_bus_speed_100) ? "100MHz" :
- (hw->bus_speed == e1000_bus_speed_66) ? "66MHz" : "33MHz"),
- ((hw->bus_width == e1000_bus_width_64) ? "64-bit" : "32-bit"));
-
- printk("%pM\n", netdev->dev_addr);
+ netif_info(adapter, probe, adapter->netdev, "(PCI%s:%s:%s) %pM\n",
+ (hw->bus_type == e1000_bus_type_pcix) ? "-X" : "",
+ (hw->bus_speed == e1000_bus_speed_133) ? "133MHz" :
+ (hw->bus_speed == e1000_bus_speed_120) ? "120MHz" :
+ (hw->bus_speed == e1000_bus_speed_100) ? "100MHz" :
+ (hw->bus_speed == e1000_bus_speed_66) ? "66MHz" : "33MHz",
+ (hw->bus_width == e1000_bus_width_64) ? "64-bit" : "32-bit",
+ netdev->dev_addr);

/* reset the hardware with the new settings */
e1000_reset(adapter);
@@ -1060,7 +1055,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
/* carrier off reporting is important to ethtool even BEFORE open */
netif_carrier_off(netdev);

- DPRINTK(PROBE, INFO, "Intel(R) PRO/1000 Network Connection\n");
+ netif_info(adapter, probe, adapter->netdev,
+ "Intel(R) PRO/1000 Network Connection\n");

cards_found++;
return 0;
@@ -1160,7 +1156,8 @@ static int __devinit e1000_sw_init(struct e1000_adapter *adapter)
/* identify the MAC */

if (e1000_set_mac_type(hw)) {
- DPRINTK(PROBE, ERR, "Unknown MAC Type\n");
+ netif_err(adapter, probe, adapter->netdev,
+ "Unknown MAC Type\n");
return -EIO;
}

@@ -1193,7 +1190,8 @@ static int __devinit e1000_sw_init(struct e1000_adapter *adapter)
adapter->num_rx_queues = 1;

if (e1000_alloc_queues(adapter)) {
- DPRINTK(PROBE, ERR, "Unable to allocate memory for queues\n");
+ netif_err(adapter, probe, adapter->netdev,
+ "Unable to allocate memory for queues\n");
return -ENOMEM;
}

@@ -1387,8 +1385,8 @@ static int e1000_setup_tx_resources(struct e1000_adapter *adapter,
size = sizeof(struct e1000_buffer) * txdr->count;
txdr->buffer_info = vmalloc(size);
if (!txdr->buffer_info) {
- DPRINTK(PROBE, ERR,
- "Unable to allocate memory for the transmit descriptor ring\n");
+ netif_err(adapter, probe, adapter->netdev,
+ "Unable to allocate memory for the transmit descriptor ring\n");
return -ENOMEM;
}
memset(txdr->buffer_info, 0, size);
@@ -1402,8 +1400,8 @@ static int e1000_setup_tx_resources(struct e1000_adapter *adapter,
if (!txdr->desc) {
setup_tx_desc_die:
vfree(txdr->buffer_info);
- DPRINTK(PROBE, ERR,
- "Unable to allocate memory for the transmit descriptor ring\n");
+ netif_err(adapter, probe, adapter->netdev,
+ "Unable to allocate memory for the transmit descriptor ring\n");
return -ENOMEM;
}

@@ -1411,8 +1409,9 @@ setup_tx_desc_die:
if (!e1000_check_64k_bound(adapter, txdr->desc, txdr->size)) {
void *olddesc = txdr->desc;
dma_addr_t olddma = txdr->dma;
- DPRINTK(TX_ERR, ERR, "txdr align check failed: %u bytes "
- "at %p\n", txdr->size, txdr->desc);
+ netif_err(adapter, tx_err, adapter->netdev,
+ "txdr align check failed: %u bytes at %p\n",
+ txdr->size, txdr->desc);
/* Try again, without freeing the previous */
txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma);
/* Failed allocation, critical failure */
@@ -1426,9 +1425,8 @@ setup_tx_desc_die:
pci_free_consistent(pdev, txdr->size, txdr->desc,
txdr->dma);
pci_free_consistent(pdev, txdr->size, olddesc, olddma);
- DPRINTK(PROBE, ERR,
- "Unable to allocate aligned memory "
- "for the transmit descriptor ring\n");
+ netif_err(adapter, probe, adapter->netdev,
+ "Unable to allocate aligned memory for the transmit descriptor ring\n");
vfree(txdr->buffer_info);
return -ENOMEM;
} else {
@@ -1459,8 +1457,8 @@ int e1000_setup_all_tx_resources(struct e1000_adapter *adapter)
for (i = 0; i < adapter->num_tx_queues; i++) {
err = e1000_setup_tx_resources(adapter, &adapter->tx_ring[i]);
if (err) {
- DPRINTK(PROBE, ERR,
- "Allocation for Tx Queue %u failed\n", i);
+ netif_err(adapter, probe, adapter->netdev,
+ "Allocation for Tx Queue %u failed\n", i);
for (i-- ; i >= 0; i--)
e1000_free_tx_resources(adapter,
&adapter->tx_ring[i]);
@@ -1580,8 +1578,8 @@ static int e1000_setup_rx_resources(struct e1000_adapter *adapter,
size = sizeof(struct e1000_buffer) * rxdr->count;
rxdr->buffer_info = vmalloc(size);
if (!rxdr->buffer_info) {
- DPRINTK(PROBE, ERR,
- "Unable to allocate memory for the receive descriptor ring\n");
+ netif_err(adapter, probe, adapter->netdev,
+ "Unable to allocate memory for the receive descriptor ring\n");
return -ENOMEM;
}
memset(rxdr->buffer_info, 0, size);
@@ -1596,8 +1594,8 @@ static int e1000_setup_rx_resources(struct e1000_adapter *adapter,
rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma);

if (!rxdr->desc) {
- DPRINTK(PROBE, ERR,
- "Unable to allocate memory for the receive descriptor ring\n");
+ netif_err(adapter, probe, adapter->netdev,
+ "Unable to allocate memory for the receive descriptor ring\n");
setup_rx_desc_die:
vfree(rxdr->buffer_info);
return -ENOMEM;
@@ -1607,16 +1605,16 @@ setup_rx_desc_die:
if (!e1000_check_64k_bound(adapter, rxdr->desc, rxdr->size)) {
void *olddesc = rxdr->desc;
dma_addr_t olddma = rxdr->dma;
- DPRINTK(RX_ERR, ERR, "rxdr align check failed: %u bytes "
- "at %p\n", rxdr->size, rxdr->desc);
+ netif_err(adapter, rx_err, adapter->netdev,
+ "rxdr align check failed: %u bytes at %p\n",
+ rxdr->size, rxdr->desc);
/* Try again, without freeing the previous */
rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma);
/* Failed allocation, critical failure */
if (!rxdr->desc) {
pci_free_consistent(pdev, rxdr->size, olddesc, olddma);
- DPRINTK(PROBE, ERR,
- "Unable to allocate memory "
- "for the receive descriptor ring\n");
+ netif_err(adapter, probe, adapter->netdev,
+ "Unable to allocate memory for the receive descriptor ring\n");
goto setup_rx_desc_die;
}

@@ -1625,9 +1623,8 @@ setup_rx_desc_die:
pci_free_consistent(pdev, rxdr->size, rxdr->desc,
rxdr->dma);
pci_free_consistent(pdev, rxdr->size, olddesc, olddma);
- DPRINTK(PROBE, ERR,
- "Unable to allocate aligned memory "
- "for the receive descriptor ring\n");
+ netif_err(adapter, probe, adapter->netdev,
+ "Unable to allocate aligned memory for the receive descriptor ring\n");
goto setup_rx_desc_die;
} else {
/* Free old allocation, new allocation was successful */
@@ -1658,8 +1655,8 @@ int e1000_setup_all_rx_resources(struct e1000_adapter *adapter)
for (i = 0; i < adapter->num_rx_queues; i++) {
err = e1000_setup_rx_resources(adapter, &adapter->rx_ring[i]);
if (err) {
- DPRINTK(PROBE, ERR,
- "Allocation for Rx Queue %u failed\n", i);
+ netif_err(adapter, probe, adapter->netdev,
+ "Allocation for Rx Queue %u failed\n", i);
for (i-- ; i >= 0; i--)
e1000_free_rx_resources(adapter,
&adapter->rx_ring[i]);
@@ -2109,7 +2106,8 @@ static void e1000_set_rx_mode(struct net_device *netdev)
u32 *mcarray = kcalloc(mta_reg_count, sizeof(u32), GFP_ATOMIC);

if (!mcarray) {
- DPRINTK(PROBE, ERR, "memory allocation failed\n");
+ netif_err(adapter, probe, adapter->netdev,
+ "memory allocation failed\n");
return;
}

@@ -2309,16 +2307,14 @@ static void e1000_watchdog(unsigned long data)
&adapter->link_duplex);

ctrl = er32(CTRL);
- printk(KERN_INFO "e1000: %s NIC Link is Up %d Mbps %s, "
- "Flow Control: %s\n",
- netdev->name,
- adapter->link_speed,
- adapter->link_duplex == FULL_DUPLEX ?
- "Full Duplex" : "Half Duplex",
- ((ctrl & E1000_CTRL_TFCE) && (ctrl &
- E1000_CTRL_RFCE)) ? "RX/TX" : ((ctrl &
- E1000_CTRL_RFCE) ? "RX" : ((ctrl &
- E1000_CTRL_TFCE) ? "TX" : "None" )));
+ netdev_info(netdev, "NIC Link is Up %d Mbps %s, Flow Control: %s\n",
+ adapter->link_speed,
+ adapter->link_duplex == FULL_DUPLEX ?
+ "Full Duplex" : "Half Duplex",
+ ((ctrl & E1000_CTRL_TFCE) &&
+ (ctrl & E1000_CTRL_RFCE)) ? "RX/TX" :
+ (ctrl & E1000_CTRL_RFCE) ? "RX" :
+ (ctrl & E1000_CTRL_TFCE) ? "TX" : "None");

/* tweak tx_queue_len according to speed/duplex
* and adjust the timeout factor */
@@ -2352,8 +2348,7 @@ static void e1000_watchdog(unsigned long data)
if (netif_carrier_ok(netdev)) {
adapter->link_speed = 0;
adapter->link_duplex = 0;
- printk(KERN_INFO "e1000: %s NIC Link is Down\n",
- netdev->name);
+ netdev_info(netdev, "NIC Link is Down\n");
netif_carrier_off(netdev);

if (!test_bit(__E1000_DOWN, &adapter->flags))
@@ -2643,8 +2638,9 @@ static bool e1000_tx_csum(struct e1000_adapter *adapter,
break;
default:
if (unlikely(net_ratelimit()))
- DPRINTK(DRV, WARNING,
- "checksum_partial proto=%x!\n", skb->protocol);
+ netif_warn(adapter, drv, adapter->netdev,
+ "checksum_partial proto=%x!\n",
+ skb->protocol);
break;
}

@@ -2987,8 +2983,8 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
/* fall through */
pull_size = min((unsigned int)4, skb->data_len);
if (!__pskb_pull_tail(skb, pull_size)) {
- DPRINTK(DRV, ERR,
- "__pskb_pull_tail failed.\n");
+ netif_err(adapter, drv, adapter->netdev,
+ "__pskb_pull_tail failed\n");
dev_kfree_skb_any(skb);
return NETDEV_TX_OK;
}
@@ -3136,7 +3132,8 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)

if ((max_frame < MINIMUM_ETHERNET_FRAME_SIZE) ||
(max_frame > MAX_JUMBO_FRAME_SIZE)) {
- DPRINTK(PROBE, ERR, "Invalid MTU setting\n");
+ netif_err(adapter, probe, adapter->netdev,
+ "Invalid MTU setting\n");
return -EINVAL;
}

@@ -3144,7 +3141,8 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
switch (hw->mac_type) {
case e1000_undefined ... e1000_82542_rev2_1:
if (max_frame > (ETH_FRAME_LEN + ETH_FCS_LEN)) {
- DPRINTK(PROBE, ERR, "Jumbo Frames not supported.\n");
+ netif_err(adapter, probe, adapter->netdev,
+ "Jumbo Frames not supported\n");
return -EINVAL;
}
break;
@@ -3182,8 +3180,8 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
(max_frame == MAXIMUM_ETHERNET_VLAN_SIZE)))
adapter->rx_buffer_len = MAXIMUM_ETHERNET_VLAN_SIZE;

- printk(KERN_INFO "e1000: %s changing MTU from %d to %d\n",
- netdev->name, netdev->mtu, new_mtu);
+ netdev_info(netdev, "changing MTU from %d to %d\n",
+ netdev->mtu, new_mtu);
netdev->mtu = new_mtu;

if (netif_running(netdev))
@@ -3496,27 +3494,28 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter,
!(er32(STATUS) & E1000_STATUS_TXOFF)) {

/* detected Tx unit hang */
- DPRINTK(DRV, ERR, "Detected Tx Unit Hang\n"
- " Tx Queue <%lu>\n"
- " TDH <%x>\n"
- " TDT <%x>\n"
- " next_to_use <%x>\n"
- " next_to_clean <%x>\n"
- "buffer_info[next_to_clean]\n"
- " time_stamp <%lx>\n"
- " next_to_watch <%x>\n"
- " jiffies <%lx>\n"
- " next_to_watch.status <%x>\n",
- (unsigned long)((tx_ring - adapter->tx_ring) /
- sizeof(struct e1000_tx_ring)),
- readl(hw->hw_addr + tx_ring->tdh),
- readl(hw->hw_addr + tx_ring->tdt),
- tx_ring->next_to_use,
- tx_ring->next_to_clean,
- tx_ring->buffer_info[eop].time_stamp,
- eop,
- jiffies,
- eop_desc->upper.fields.status);
+ netif_err(adapter, drv, adapter->netdev,
+ "Detected Tx Unit Hang\n"
+ " Tx Queue <%lu>\n"
+ " TDH <%x>\n"
+ " TDT <%x>\n"
+ " next_to_use <%x>\n"
+ " next_to_clean <%x>\n"
+ "buffer_info[next_to_clean]\n"
+ " time_stamp <%lx>\n"
+ " next_to_watch <%x>\n"
+ " jiffies <%lx>\n"
+ " next_to_watch.status <%x>\n",
+ (unsigned long)((tx_ring - adapter->tx_ring) /
+ sizeof(struct e1000_tx_ring)),
+ readl(hw->hw_addr + tx_ring->tdh),
+ readl(hw->hw_addr + tx_ring->tdt),
+ tx_ring->next_to_use,
+ tx_ring->next_to_clean,
+ tx_ring->buffer_info[eop].time_stamp,
+ eop,
+ jiffies,
+ eop_desc->upper.fields.status);
netif_stop_queue(netdev);
}
}
@@ -3745,7 +3744,8 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter,

/* eth type trans needs skb->data to point to something */
if (!pskb_may_pull(skb, ETH_HLEN)) {
- DPRINTK(DRV, ERR, "pskb_may_pull failed.\n");
+ netif_err(adapter, drv, adapter->netdev,
+ "pskb_may_pull failed\n");
dev_kfree_skb(skb);
goto next_desc;
}
@@ -3845,8 +3845,7 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,

if (adapter->discarding) {
/* All receives must fit into a single buffer */
- E1000_DBG("%s: Receive packet consumed multiple"
- " buffers\n", netdev->name);
+ netdev_dbg(netdev, "Receive packet consumed multiple buffers\n");
/* recycle */
buffer_info->skb = skb;
if (status & E1000_RXD_STAT_EOP)
@@ -3976,8 +3975,9 @@ e1000_alloc_jumbo_rx_buffers(struct e1000_adapter *adapter,
/* Fix for errata 23, can't cross 64kB boundary */
if (!e1000_check_64k_bound(adapter, skb->data, bufsz)) {
struct sk_buff *oldskb = skb;
- DPRINTK(PROBE, ERR, "skb align check failed: %u bytes "
- "at %p\n", bufsz, skb->data);
+ netif_err(adapter, probe, adapter->netdev,
+ "skb align check failed: %u bytes at %p\n",
+ bufsz, skb->data);
/* Try again, without freeing the previous */
skb = netdev_alloc_skb_ip_align(netdev, bufsz);
/* Failed allocation, critical failure */
@@ -4075,8 +4075,9 @@ static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter,
/* Fix for errata 23, can't cross 64kB boundary */
if (!e1000_check_64k_bound(adapter, skb->data, bufsz)) {
struct sk_buff *oldskb = skb;
- DPRINTK(RX_ERR, ERR, "skb align check failed: %u bytes "
- "at %p\n", bufsz, skb->data);
+ netif_err(adapter, rx_err, adapter->netdev,
+ "skb align check failed: %u bytes at %p\n",
+ bufsz, skb->data);
/* Try again, without freeing the previous */
skb = netdev_alloc_skb_ip_align(netdev, bufsz);
/* Failed allocation, critical failure */
@@ -4114,10 +4115,10 @@ map_skb:
if (!e1000_check_64k_bound(adapter,
(void *)(unsigned long)buffer_info->dma,
adapter->rx_buffer_len)) {
- DPRINTK(RX_ERR, ERR,
- "dma align check failed: %u bytes at %p\n",
- adapter->rx_buffer_len,
- (void *)(unsigned long)buffer_info->dma);
+ netif_err(adapter, rx_err, adapter->netdev,
+ "dma align check failed: %u bytes at %p\n",
+ adapter->rx_buffer_len,
+ (void *)(unsigned long)buffer_info->dma);
dev_kfree_skb(skb);
buffer_info->skb = NULL;

@@ -4329,7 +4330,8 @@ void e1000_pci_set_mwi(struct e1000_hw *hw)
int ret_val = pci_set_mwi(adapter->pdev);

if (ret_val)
- DPRINTK(PROBE, ERR, "Error in setting MWI\n");
+ netif_err(adapter, probe, adapter->netdev,
+ "Error in setting MWI\n");
}

void e1000_pci_clear_mwi(struct e1000_hw *hw)
@@ -4460,7 +4462,8 @@ int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx)
/* Fiber NICs only allow 1000 gbps Full duplex */
if ((hw->media_type == e1000_media_type_fiber) &&
spddplx != (SPEED_1000 + DUPLEX_FULL)) {
- DPRINTK(PROBE, ERR, "Unsupported Speed/Duplex configuration\n");
+ netif_err(adapter, probe, adapter->netdev,
+ "Unsupported Speed/Duplex configuration\n");
return -EINVAL;
}

@@ -4483,7 +4486,8 @@ int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx)
break;
case SPEED_1000 + DUPLEX_HALF: /* not supported */
default:
- DPRINTK(PROBE, ERR, "Unsupported Speed/Duplex configuration\n");
+ netif_err(adapter, probe, adapter->netdev,
+ "Unsupported Speed/Duplex configuration\n");
return -EINVAL;
}
return 0;
@@ -4606,7 +4610,7 @@ static int e1000_resume(struct pci_dev *pdev)
else
err = pci_enable_device_mem(pdev);
if (err) {
- printk(KERN_ERR "e1000: Cannot enable PCI device from suspend\n");
+ pr_err("Cannot enable PCI device from suspend\n");
return err;
}
pci_set_master(pdev);
@@ -4709,7 +4713,7 @@ static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev)
else
err = pci_enable_device_mem(pdev);
if (err) {
- printk(KERN_ERR "e1000: Cannot re-enable PCI device after reset.\n");
+ pr_err("Cannot re-enable PCI device after reset\n");
return PCI_ERS_RESULT_DISCONNECT;
}
pci_set_master(pdev);
@@ -4740,7 +4744,7 @@ static void e1000_io_resume(struct pci_dev *pdev)

if (netif_running(netdev)) {
if (e1000_up(adapter)) {
- printk("e1000: can't bring device back up after reset\n");
+ netdev_err(netdev, "can't bring device back up after reset\n");
return;
}
}
diff --git a/drivers/net/e1000/e1000_osdep.h b/drivers/net/e1000/e1000_osdep.h
index d929852..f8db5fe 100644
--- a/drivers/net/e1000/e1000_osdep.h
+++ b/drivers/net/e1000/e1000_osdep.h
@@ -41,19 +41,7 @@
#include <linux/interrupt.h>
#include <linux/sched.h>

-#ifdef DBG
-#define DEBUGOUT(S) printk(KERN_DEBUG S "\n")
-#define DEBUGOUT1(S, A...) printk(KERN_DEBUG S "\n", A)
-#else
-#define DEBUGOUT(S)
-#define DEBUGOUT1(S, A...)
-#endif
-
-#define DEBUGFUNC(F) DEBUGOUT(F "\n")
-#define DEBUGOUT2 DEBUGOUT1
-#define DEBUGOUT3 DEBUGOUT2
-#define DEBUGOUT7 DEBUGOUT3
-
+#define ENTER() pr_debug("%s\n", __func__)

#define er32(reg) \
(readl(hw->hw_addr + ((hw->mac_type >= e1000_82543) \
diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c
index 38d2741..22d1eb9 100644
--- a/drivers/net/e1000/e1000_param.c
+++ b/drivers/net/e1000/e1000_param.c
@@ -226,17 +226,19 @@ static int __devinit e1000_validate_option(unsigned int *value,
case enable_option:
switch (*value) {
case OPTION_ENABLED:
- DPRINTK(PROBE, INFO, "%s Enabled\n", opt->name);
+ netif_info(adapter, probe, adapter->netdev,
+ "%s Enabled\n", opt->name);
return 0;
case OPTION_DISABLED:
- DPRINTK(PROBE, INFO, "%s Disabled\n", opt->name);
+ netif_info(adapter, probe, adapter->netdev,
+ "%s Disabled\n", opt->name);
return 0;
}
break;
case range_option:
if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) {
- DPRINTK(PROBE, INFO,
- "%s set to %i\n", opt->name, *value);
+ netif_info(adapter, probe, adapter->netdev,
+ "%s set to %i\n", opt->name, *value);
return 0;
}
break;
@@ -248,7 +250,8 @@ static int __devinit e1000_validate_option(unsigned int *value,
ent = &opt->arg.l.p[i];
if (*value == ent->i) {
if (ent->str[0] != '\0')
- DPRINTK(PROBE, INFO, "%s\n", ent->str);
+ netif_info(adapter, probe, adapter->netdev,
+ "%s\n", ent->str);
return 0;
}
}
@@ -258,8 +261,9 @@ static int __devinit e1000_validate_option(unsigned int *value,
BUG();
}

- DPRINTK(PROBE, INFO, "Invalid %s value specified (%i) %s\n",
- opt->name, *value, opt->err);
+ netif_info(adapter, probe, adapter->netdev,
+ "Invalid %s value specified (%i) %s\n",
+ opt->name, *value, opt->err);
*value = opt->def;
return -1;
}
@@ -283,9 +287,11 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter)
int bd = adapter->bd_number;

if (bd >= E1000_MAX_NIC) {
- DPRINTK(PROBE, NOTICE,
- "Warning: no configuration for board #%i\n", bd);
- DPRINTK(PROBE, NOTICE, "Using defaults for all values\n");
+ netif_notice(adapter, probe, adapter->netdev,
+ "Warning: no configuration for board #%i\n",
+ bd);
+ netif_notice(adapter, probe, adapter->netdev,
+ "Using defaults for all values\n");
}

{ /* Transmit Descriptor Count */
@@ -472,19 +478,20 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter)
adapter->itr = InterruptThrottleRate[bd];
switch (adapter->itr) {
case 0:
- DPRINTK(PROBE, INFO, "%s turned off\n",
- opt.name);
+ netif_info(adapter, probe, adapter->netdev,
+ "%s turned off\n", opt.name);
break;
case 1:
- DPRINTK(PROBE, INFO, "%s set to dynamic mode\n",
- opt.name);
+ netif_info(adapter, probe, adapter->netdev,
+ "%s set to dynamic mode\n",
+ opt.name);
adapter->itr_setting = adapter->itr;
adapter->itr = 20000;
break;
case 3:
- DPRINTK(PROBE, INFO,
- "%s set to dynamic conservative mode\n",
- opt.name);
+ netif_info(adapter, probe, adapter->netdev,
+ "%s set to dynamic conservative mode\n",
+ opt.name);
adapter->itr_setting = adapter->itr;
adapter->itr = 20000;
break;
@@ -543,19 +550,18 @@ static void __devinit e1000_check_fiber_options(struct e1000_adapter *adapter)
{
int bd = adapter->bd_number;
if (num_Speed > bd) {
- DPRINTK(PROBE, INFO, "Speed not valid for fiber adapters, "
- "parameter ignored\n");
+ netif_info(adapter, probe, adapter->netdev,
+ "Speed not valid for fiber adapters, parameter ignored\n");
}

if (num_Duplex > bd) {
- DPRINTK(PROBE, INFO, "Duplex not valid for fiber adapters, "
- "parameter ignored\n");
+ netif_info(adapter, probe, adapter->netdev,
+ "Duplex not valid for fiber adapters, parameter ignored\n");
}

if ((num_AutoNeg > bd) && (AutoNeg[bd] != 0x20)) {
- DPRINTK(PROBE, INFO, "AutoNeg other than 1000/Full is "
- "not valid for fiber adapters, "
- "parameter ignored\n");
+ netif_info(adapter, probe, adapter->netdev,
+ "AutoNeg other than 1000/Full is not valid for fiber adapters, parameter ignored\n");
}
}

@@ -619,9 +625,8 @@ static void __devinit e1000_check_copper_options(struct e1000_adapter *adapter)
}

if ((num_AutoNeg > bd) && (speed != 0 || dplx != 0)) {
- DPRINTK(PROBE, INFO,
- "AutoNeg specified along with Speed or Duplex, "
- "parameter ignored\n");
+ netif_info(adapter, probe, adapter->netdev,
+ "AutoNeg specified along with Speed or Duplex, parameter ignored\n");
adapter->hw.autoneg_advertised = AUTONEG_ADV_DEFAULT;
} else { /* Autoneg */
static const struct e1000_opt_list an_list[] =
@@ -680,79 +685,86 @@ static void __devinit e1000_check_copper_options(struct e1000_adapter *adapter)
case 0:
adapter->hw.autoneg = adapter->fc_autoneg = 1;
if ((num_Speed > bd) && (speed != 0 || dplx != 0))
- DPRINTK(PROBE, INFO,
- "Speed and duplex autonegotiation enabled\n");
+ netif_info(adapter, probe, adapter->netdev,
+ "Speed and duplex autonegotiation enabled\n");
break;
case HALF_DUPLEX:
- DPRINTK(PROBE, INFO, "Half Duplex specified without Speed\n");
- DPRINTK(PROBE, INFO, "Using Autonegotiation at "
- "Half Duplex only\n");
+ netif_info(adapter, probe, adapter->netdev,
+ "Half Duplex specified without Speed\n");
+ netif_info(adapter, probe, adapter->netdev,
+ "Using Autonegotiation at Half Duplex only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_10_HALF |
ADVERTISE_100_HALF;
break;
case FULL_DUPLEX:
- DPRINTK(PROBE, INFO, "Full Duplex specified without Speed\n");
- DPRINTK(PROBE, INFO, "Using Autonegotiation at "
- "Full Duplex only\n");
+ netif_info(adapter, probe, adapter->netdev,
+ "Full Duplex specified without Speed\n");
+ netif_info(adapter, probe, adapter->netdev,
+ "Using Autonegotiation at Full Duplex only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_10_FULL |
ADVERTISE_100_FULL |
ADVERTISE_1000_FULL;
break;
case SPEED_10:
- DPRINTK(PROBE, INFO, "10 Mbps Speed specified "
- "without Duplex\n");
- DPRINTK(PROBE, INFO, "Using Autonegotiation at 10 Mbps only\n");
+ netif_info(adapter, probe, adapter->netdev,
+ "10 Mbps Speed specified without Duplex\n");
+ netif_info(adapter, probe, adapter->netdev,
+ "Using Autonegotiation at 10 Mbps only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_10_HALF |
ADVERTISE_10_FULL;
break;
case SPEED_10 + HALF_DUPLEX:
- DPRINTK(PROBE, INFO, "Forcing to 10 Mbps Half Duplex\n");
+ netif_info(adapter, probe, adapter->netdev,
+ "Forcing to 10 Mbps Half Duplex\n");
adapter->hw.autoneg = adapter->fc_autoneg = 0;
adapter->hw.forced_speed_duplex = e1000_10_half;
adapter->hw.autoneg_advertised = 0;
break;
case SPEED_10 + FULL_DUPLEX:
- DPRINTK(PROBE, INFO, "Forcing to 10 Mbps Full Duplex\n");
+ netif_info(adapter, probe, adapter->netdev,
+ "Forcing to 10 Mbps Full Duplex\n");
adapter->hw.autoneg = adapter->fc_autoneg = 0;
adapter->hw.forced_speed_duplex = e1000_10_full;
adapter->hw.autoneg_advertised = 0;
break;
case SPEED_100:
- DPRINTK(PROBE, INFO, "100 Mbps Speed specified "
- "without Duplex\n");
- DPRINTK(PROBE, INFO, "Using Autonegotiation at "
- "100 Mbps only\n");
+ netif_info(adapter, probe, adapter->netdev,
+ "100 Mbps Speed specified without Duplex\n");
+ netif_info(adapter, probe, adapter->netdev,
+ "Using Autonegotiation at 100 Mbps only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_100_HALF |
ADVERTISE_100_FULL;
break;
case SPEED_100 + HALF_DUPLEX:
- DPRINTK(PROBE, INFO, "Forcing to 100 Mbps Half Duplex\n");
+ netif_info(adapter, probe, adapter->netdev,
+ "Forcing to 100 Mbps Half Duplex\n");
adapter->hw.autoneg = adapter->fc_autoneg = 0;
adapter->hw.forced_speed_duplex = e1000_100_half;
adapter->hw.autoneg_advertised = 0;
break;
case SPEED_100 + FULL_DUPLEX:
- DPRINTK(PROBE, INFO, "Forcing to 100 Mbps Full Duplex\n");
+ netif_info(adapter, probe, adapter->netdev,
+ "Forcing to 100 Mbps Full Duplex\n");
adapter->hw.autoneg = adapter->fc_autoneg = 0;
adapter->hw.forced_speed_duplex = e1000_100_full;
adapter->hw.autoneg_advertised = 0;
break;
case SPEED_1000:
- DPRINTK(PROBE, INFO, "1000 Mbps Speed specified without "
- "Duplex\n");
+ netif_info(adapter, probe, adapter->netdev,
+ "1000 Mbps Speed specified without Duplex\n");
goto full_duplex_only;
case SPEED_1000 + HALF_DUPLEX:
- DPRINTK(PROBE, INFO,
- "Half Duplex is not supported at 1000 Mbps\n");
+ netif_info(adapter, probe, adapter->netdev,
+ "Half Duplex is not supported at 1000 Mbps\n");
/* fall through */
case SPEED_1000 + FULL_DUPLEX:
full_duplex_only:
- DPRINTK(PROBE, INFO,
- "Using Autonegotiation at 1000 Mbps Full Duplex only\n");
+ netif_info(adapter, probe, adapter->netdev,
+ "Using Autonegotiation at 1000 Mbps Full Duplex only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL;
break;
@@ -762,9 +774,8 @@ full_duplex_only:

/* Speed, AutoNeg and MDI/MDI-X must all play nice */
if (e1000_validate_mdi_setting(&(adapter->hw)) < 0) {
- DPRINTK(PROBE, INFO,
- "Speed, AutoNeg and MDI-X specifications are "
- "incompatible. Setting MDI-X to a compatible value.\n");
+ netif_info(adapter, probe, adapter->netdev,
+ "Speed, AutoNeg and MDI-X specifications are incompatible. Setting MDI-X to a compatible value\n");
}
}

--
1.7.0.14.g7e948

2010-02-23 02:57:48

by Joe Perches

[permalink] [raw]
Subject: [PATCH net-next 7/7] drivers/net/igb: Use netdev_<level>

Convert hw_dbg to netdev_dbg
Convert a couple printks to pr_<level>
Coalesce some format strings

Signed-off-by: Joe Perches <[email protected]>
---
drivers/net/igb/e1000_82575.c | 58 ++++++++++++-----------
drivers/net/igb/e1000_hw.h | 12 ++---
drivers/net/igb/e1000_mac.c | 84 ++++++++++++++++-----------------
drivers/net/igb/e1000_nvm.c | 22 ++++----
drivers/net/igb/e1000_phy.c | 104 +++++++++++++++++++++--------------------
drivers/net/igb/igb.h | 1 -
drivers/net/igb/igb_ethtool.c | 6 +--
drivers/net/igb/igb_main.c | 43 ++++++-----------
8 files changed, 157 insertions(+), 173 deletions(-)

diff --git a/drivers/net/igb/e1000_82575.c b/drivers/net/igb/e1000_82575.c
index 9d7fa2f..0db6032 100644
--- a/drivers/net/igb/e1000_82575.c
+++ b/drivers/net/igb/e1000_82575.c
@@ -33,8 +33,7 @@
#include <linux/slab.h>
#include <linux/if_ether.h>

-#include "e1000_mac.h"
-#include "e1000_82575.h"
+#include "igb.h"

static s32 igb_get_invariants_82575(struct e1000_hw *);
static s32 igb_acquire_phy_82575(struct e1000_hw *);
@@ -322,7 +321,8 @@ static s32 igb_read_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset,
s32 ret_val = -E1000_ERR_PARAM;

if (offset > E1000_MAX_SGMII_PHY_REG_ADDR) {
- hw_dbg("PHY Address %u is out of range\n", offset);
+ netdev_dbg(hw_netdev(hw), "PHY Address %u is out of range\n",
+ offset);
goto out;
}

@@ -354,7 +354,8 @@ static s32 igb_write_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset,


if (offset > E1000_MAX_SGMII_PHY_REG_ADDR) {
- hw_dbg("PHY Address %d is out of range\n", offset);
+ netdev_dbg(hw_netdev(hw), "PHY Address %d is out of range\n",
+ offset);
goto out;
}

@@ -410,8 +411,8 @@ static s32 igb_get_phy_id_82575(struct e1000_hw *hw)
for (phy->addr = 1; phy->addr < 8; phy->addr++) {
ret_val = igb_read_phy_reg_sgmii_82575(hw, PHY_ID1, &phy_id);
if (ret_val == 0) {
- hw_dbg("Vendor ID 0x%08X read at address %u\n",
- phy_id, phy->addr);
+ netdev_dbg(hw_netdev(hw), "Vendor ID 0x%08X read at address %u\n",
+ phy_id, phy->addr);
/*
* At the time of this writing, The M88 part is
* the only supported SGMII PHY product.
@@ -419,7 +420,8 @@ static s32 igb_get_phy_id_82575(struct e1000_hw *hw)
if (phy_id == M88_VENDOR)
break;
} else {
- hw_dbg("PHY address %u was unreadable\n", phy->addr);
+ netdev_dbg(hw_netdev(hw), "PHY address %u was unreadable\n",
+ phy->addr);
}
}

@@ -454,7 +456,7 @@ static s32 igb_phy_hw_reset_sgmii_82575(struct e1000_hw *hw)
* available to us at this time.
*/

- hw_dbg("Soft resetting SGMII attached PHY...\n");
+ netdev_dbg(hw_netdev(hw), "Soft resetting SGMII attached PHY...\n");

/*
* SFP documentation requires the following to configure the SPF module
@@ -622,7 +624,7 @@ static s32 igb_acquire_swfw_sync_82575(struct e1000_hw *hw, u16 mask)
}

if (i == timeout) {
- hw_dbg("Driver can't access resource, SW_FW_SYNC timeout.\n");
+ netdev_dbg(hw_netdev(hw), "Driver can't access resource, SW_FW_SYNC timeout\n");
ret_val = -E1000_ERR_SWFW_SYNC;
goto out;
}
@@ -688,7 +690,7 @@ static s32 igb_get_cfg_done_82575(struct e1000_hw *hw)
timeout--;
}
if (!timeout)
- hw_dbg("MNG configuration cycle has not completed.\n");
+ netdev_dbg(hw_netdev(hw), "MNG configuration cycle has not completed\n");

/* If EEPROM is not marked present, init the PHY manually */
if (((rd32(E1000_EECD) & E1000_EECD_PRES) == 0) &&
@@ -859,15 +861,15 @@ static s32 igb_reset_hw_82575(struct e1000_hw *hw)
*/
ret_val = igb_disable_pcie_master(hw);
if (ret_val)
- hw_dbg("PCI-E Master disable polling has failed.\n");
+ netdev_dbg(hw_netdev(hw), "PCI-E Master disable polling has failed\n");

/* set the completion timeout for interface */
ret_val = igb_set_pcie_completion_timeout(hw);
if (ret_val) {
- hw_dbg("PCI-E Set completion timeout has failed.\n");
+ netdev_dbg(hw_netdev(hw), "PCI-E Set completion timeout has failed\n");
}

- hw_dbg("Masking off all interrupts\n");
+ netdev_dbg(hw_netdev(hw), "Masking off all interrupts\n");
wr32(E1000_IMC, 0xffffffff);

wr32(E1000_RCTL, 0);
@@ -878,7 +880,7 @@ static s32 igb_reset_hw_82575(struct e1000_hw *hw)

ctrl = rd32(E1000_CTRL);

- hw_dbg("Issuing a global reset to MAC\n");
+ netdev_dbg(hw_netdev(hw), "Issuing a global reset to MAC\n");
wr32(E1000_CTRL, ctrl | E1000_CTRL_RST);

ret_val = igb_get_auto_rd_done(hw);
@@ -888,7 +890,7 @@ static s32 igb_reset_hw_82575(struct e1000_hw *hw)
* return with an error. This can happen in situations
* where there is no eeprom and prevents getting link.
*/
- hw_dbg("Auto Read Done did not complete\n");
+ netdev_dbg(hw_netdev(hw), "Auto Read Done did not complete\n");
}

/* If EEPROM is not present, run manual init scripts */
@@ -920,24 +922,24 @@ static s32 igb_init_hw_82575(struct e1000_hw *hw)
/* Initialize identification LED */
ret_val = igb_id_led_init(hw);
if (ret_val) {
- hw_dbg("Error initializing identification LED\n");
+ netdev_dbg(hw_netdev(hw), "Error initializing identification LED\n");
/* This is not fatal and we should not stop init due to this */
}

/* Disabling VLAN filtering */
- hw_dbg("Initializing the IEEE VLAN\n");
+ netdev_dbg(hw_netdev(hw), "Initializing the IEEE VLAN\n");
igb_clear_vfta(hw);

/* Setup the receive address */
igb_init_rx_addrs(hw, rar_count);

/* Zero out the Multicast HASH table */
- hw_dbg("Zeroing the MTA\n");
+ netdev_dbg(hw_netdev(hw), "Zeroing the MTA\n");
for (i = 0; i < mac->mta_reg_count; i++)
array_wr32(E1000_MTA, i, 0);

/* Zero out the Unicast HASH table */
- hw_dbg("Zeroing the UTA\n");
+ netdev_dbg(hw_netdev(hw), "Zeroing the UTA\n");
for (i = 0; i < mac->uta_reg_count; i++)
array_wr32(E1000_UTA, i, 0);

@@ -983,7 +985,7 @@ static s32 igb_setup_copper_link_82575(struct e1000_hw *hw)

ret_val = hw->phy.ops.reset(hw);
if (ret_val) {
- hw_dbg("Error resetting the PHY.\n");
+ netdev_dbg(hw_netdev(hw), "Error resetting the PHY\n");
goto out;
}
}
@@ -1104,12 +1106,14 @@ static s32 igb_setup_serdes_link_82575(struct e1000_hw *hw)
/* Set PCS register for autoneg */
reg |= E1000_PCS_LCTL_AN_ENABLE | /* Enable Autoneg */
E1000_PCS_LCTL_AN_RESTART; /* Restart autoneg */
- hw_dbg("Configuring Autoneg:PCS_LCTL=0x%08X\n", reg);
+ netdev_dbg(hw_netdev(hw), "Configuring Autoneg:PCS_LCTL=0x%08X\n",
+ reg);
} else {
/* Set PCS register for forced link */
reg |= E1000_PCS_LCTL_FSD; /* Force Speed */

- hw_dbg("Configuring Forced Link:PCS_LCTL=0x%08X\n", reg);
+ netdev_dbg(hw_netdev(hw), "Configuring Forced Link:PCS_LCTL=0x%08X\n",
+ reg);
}

wr32(E1000_PCS_LCTL, reg);
@@ -1144,7 +1148,7 @@ static bool igb_sgmii_active_82575(struct e1000_hw *hw)
static s32 igb_reset_init_script_82575(struct e1000_hw *hw)
{
if (hw->mac.type == e1000_82575) {
- hw_dbg("Running reset init script for 82575\n");
+ netdev_dbg(hw_netdev(hw), "Running reset init script for 82575\n");
/* SerDes configuration via SERDESCTRL */
igb_write_8bit_ctrl_reg(hw, E1000_SCTL, 0x00, 0x0C);
igb_write_8bit_ctrl_reg(hw, E1000_SCTL, 0x01, 0x78);
@@ -1307,7 +1311,7 @@ void igb_rx_fifo_flush_82575(struct e1000_hw *hw)
}

if (ms_wait == 10)
- hw_dbg("Queue disable timed out after 10ms\n");
+ netdev_dbg(hw_netdev(hw), "Queue disable timed out after 10ms\n");

/* Clear RLPML, RCTL.SBP, RFCTL.LEF, and set RCTL.LPE so that all
* incoming packets are rejected. Set enable and wait 2ms so that
@@ -1532,9 +1536,9 @@ static s32 igb_reset_hw_82580(struct e1000_hw *hw)
*/
ret_val = igb_disable_pcie_master(hw);
if (ret_val)
- hw_dbg("PCI-E Master disable polling has failed.\n");
+ netdev_dbg(hw_netdev(hw), "PCI-E Master disable polling has failed\n");

- hw_dbg("Masking off all interrupts\n");
+ netdev_dbg(hw_netdev(hw), "Masking off all interrupts\n");
wr32(E1000_IMC, 0xffffffff);
wr32(E1000_RCTL, 0);
wr32(E1000_TCTL, E1000_TCTL_PSP);
@@ -1566,7 +1570,7 @@ static s32 igb_reset_hw_82580(struct e1000_hw *hw)
* return with an error. This can happen in situations
* where there is no eeprom and prevents getting link.
*/
- hw_dbg("Auto Read Done did not complete\n");
+ netdev_dbg(hw_netdev(hw), "Auto Read Done did not complete\n");
}

/* If EEPROM is not present, run manual init scripts */
diff --git a/drivers/net/igb/e1000_hw.h b/drivers/net/igb/e1000_hw.h
index 4480052..7dc3166 100644
--- a/drivers/net/igb/e1000_hw.h
+++ b/drivers/net/igb/e1000_hw.h
@@ -31,6 +31,7 @@
#include <linux/types.h>
#include <linux/delay.h>
#include <linux/io.h>
+#include <linux/netdevice.h>

#include "e1000_regs.h"
#include "e1000_defines.h"
@@ -501,14 +502,11 @@ struct e1000_hw {
u8 revision_id;
};

-#ifdef DEBUG
-extern char *igb_get_hw_dev_name(struct e1000_hw *hw);
-#define hw_dbg(format, arg...) \
- printk(KERN_DEBUG "%s: " format, igb_get_hw_dev_name(hw), ##arg)
-#else
-#define hw_dbg(format, arg...)
-#endif
+/* get (struct net_device *) from (struct e1000_hw *) */
+#define hw_netdev(hw) (((struct igb_adapter *)((hw)->back))->netdev)
+
#endif
+
/* These functions must be implemented by drivers */
s32 igb_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value);
s32 igb_write_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value);
diff --git a/drivers/net/igb/e1000_mac.c b/drivers/net/igb/e1000_mac.c
index 2a8a886..d8f1cf1 100644
--- a/drivers/net/igb/e1000_mac.c
+++ b/drivers/net/igb/e1000_mac.c
@@ -28,7 +28,6 @@
#include <linux/if_ether.h>
#include <linux/delay.h>
#include <linux/pci.h>
-#include <linux/netdevice.h>

#include "e1000_mac.h"

@@ -118,12 +117,12 @@ void igb_init_rx_addrs(struct e1000_hw *hw, u16 rar_count)
u8 mac_addr[ETH_ALEN] = {0};

/* Setup the receive address */
- hw_dbg("Programming MAC Address into RAR[0]\n");
+ netdev_dbg(hw_netdev(hw), "Programming MAC Address into RAR[0]\n");

hw->mac.ops.rar_set(hw, hw->mac.addr, 0);

/* Zero out the other (rar_entry_count - 1) receive addresses */
- hw_dbg("Clearing RAR[1-%u]\n", rar_count-1);
+ netdev_dbg(hw_netdev(hw), "Clearing RAR[1-%u]\n", rar_count-1);
for (i = 1; i < rar_count; i++)
hw->mac.ops.rar_set(hw, mac_addr, i);
}
@@ -180,7 +179,7 @@ s32 igb_check_alt_mac_addr(struct e1000_hw *hw)
ret_val = hw->nvm.ops.read(hw, NVM_ALT_MAC_ADDR_PTR, 1,
&nvm_alt_mac_addr_offset);
if (ret_val) {
- hw_dbg("NVM Read Error\n");
+ netdev_dbg(hw_netdev(hw), "NVM Read Error\n");
goto out;
}

@@ -195,7 +194,7 @@ s32 igb_check_alt_mac_addr(struct e1000_hw *hw)
offset = nvm_alt_mac_addr_offset + (i >> 1);
ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data);
if (ret_val) {
- hw_dbg("NVM Read Error\n");
+ netdev_dbg(hw_netdev(hw), "NVM Read Error\n");
goto out;
}

@@ -205,7 +204,7 @@ s32 igb_check_alt_mac_addr(struct e1000_hw *hw)

/* if multicast bit is set, the alternate address will not be used */
if (alt_mac_addr[0] & 0x01) {
- hw_dbg("Ignoring Alternate Mac Address with MC bit set\n");
+ netdev_dbg(hw_netdev(hw), "Ignoring Alternate Mac Address with MC bit set\n");
goto out;
}

@@ -515,7 +514,7 @@ s32 igb_check_for_copper_link(struct e1000_hw *hw)
*/
ret_val = igb_config_fc_after_link_up(hw);
if (ret_val)
- hw_dbg("Error configuring flow control\n");
+ netdev_dbg(hw_netdev(hw), "Error configuring flow control\n");

out:
return ret_val;
@@ -559,7 +558,8 @@ s32 igb_setup_link(struct e1000_hw *hw)
*/
hw->fc.current_mode = hw->fc.requested_mode;

- hw_dbg("After fix-ups FlowControl is now = %x\n", hw->fc.current_mode);
+ netdev_dbg(hw_netdev(hw), "After fix-ups FlowControl is now = %x\n",
+ hw->fc.current_mode);

/* Call the necessary media_type subroutine to configure the link. */
ret_val = hw->mac.ops.setup_physical_interface(hw);
@@ -572,7 +572,7 @@ s32 igb_setup_link(struct e1000_hw *hw)
* control is disabled, because it does not hurt anything to
* initialize these registers.
*/
- hw_dbg("Initializing the Flow Control address, type and timer regs\n");
+ netdev_dbg(hw_netdev(hw), "Initializing the Flow Control address, type and timer regs\n");
wr32(E1000_FCT, FLOW_CONTROL_TYPE);
wr32(E1000_FCAH, FLOW_CONTROL_ADDRESS_HIGH);
wr32(E1000_FCAL, FLOW_CONTROL_ADDRESS_LOW);
@@ -668,7 +668,7 @@ static s32 igb_set_default_fc(struct e1000_hw *hw)
ret_val = hw->nvm.ops.read(hw, NVM_INIT_CONTROL2_REG, 1, &nvm_data);

if (ret_val) {
- hw_dbg("NVM Read Error\n");
+ netdev_dbg(hw_netdev(hw), "NVM Read Error\n");
goto out;
}

@@ -719,7 +719,8 @@ s32 igb_force_mac_fc(struct e1000_hw *hw)
* 3: Both Rx and TX flow control (symmetric) is enabled.
* other: No other values should be possible at this point.
*/
- hw_dbg("hw->fc.current_mode = %u\n", hw->fc.current_mode);
+ netdev_dbg(hw_netdev(hw), "hw->fc.current_mode = %u\n",
+ hw->fc.current_mode);

switch (hw->fc.current_mode) {
case e1000_fc_none:
@@ -737,7 +738,7 @@ s32 igb_force_mac_fc(struct e1000_hw *hw)
ctrl |= (E1000_CTRL_TFCE | E1000_CTRL_RFCE);
break;
default:
- hw_dbg("Flow control param set incorrectly\n");
+ netdev_dbg(hw_netdev(hw), "Flow control param set incorrectly\n");
ret_val = -E1000_ERR_CONFIG;
goto out;
}
@@ -779,7 +780,7 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)
}

if (ret_val) {
- hw_dbg("Error forcing flow control settings\n");
+ netdev_dbg(hw_netdev(hw), "Error forcing flow control settings\n");
goto out;
}

@@ -805,8 +806,7 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)
goto out;

if (!(mii_status_reg & MII_SR_AUTONEG_COMPLETE)) {
- hw_dbg("Copper PHY and Auto Neg "
- "has not completed.\n");
+ netdev_dbg(hw_netdev(hw), "Copper PHY and Auto Neg has not completed\n");
goto out;
}

@@ -871,11 +871,10 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)
*/
if (hw->fc.requested_mode == e1000_fc_full) {
hw->fc.current_mode = e1000_fc_full;
- hw_dbg("Flow Control = FULL.\r\n");
+ netdev_dbg(hw_netdev(hw), "Flow Control = FULL.\r\n");
} else {
hw->fc.current_mode = e1000_fc_rx_pause;
- hw_dbg("Flow Control = "
- "RX PAUSE frames only.\r\n");
+ netdev_dbg(hw_netdev(hw), "Flow Control = RX PAUSE frames only.\r\n");
}
}
/*
@@ -891,7 +890,7 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)
(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) &&
(mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) {
hw->fc.current_mode = e1000_fc_tx_pause;
- hw_dbg("Flow Control = TX PAUSE frames only.\r\n");
+ netdev_dbg(hw_netdev(hw), "Flow Control = TX PAUSE frames only.\r\n");
}
/*
* For transmitting PAUSE frames ONLY.
@@ -906,7 +905,7 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)
!(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) &&
(mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) {
hw->fc.current_mode = e1000_fc_rx_pause;
- hw_dbg("Flow Control = RX PAUSE frames only.\r\n");
+ netdev_dbg(hw_netdev(hw), "Flow Control = RX PAUSE frames only.\r\n");
}
/*
* Per the IEEE spec, at this point flow control should be
@@ -933,10 +932,10 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)
hw->fc.requested_mode == e1000_fc_tx_pause) ||
hw->fc.strict_ieee) {
hw->fc.current_mode = e1000_fc_none;
- hw_dbg("Flow Control = NONE.\r\n");
+ netdev_dbg(hw_netdev(hw), "Flow Control = NONE.\r\n");
} else {
hw->fc.current_mode = e1000_fc_rx_pause;
- hw_dbg("Flow Control = RX PAUSE frames only.\r\n");
+ netdev_dbg(hw_netdev(hw), "Flow Control = RX PAUSE frames only.\r\n");
}

/*
@@ -946,7 +945,7 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)
*/
ret_val = hw->mac.ops.get_speed_and_duplex(hw, &speed, &duplex);
if (ret_val) {
- hw_dbg("Error getting link speed and duplex\n");
+ netdev_dbg(hw_netdev(hw), "Error getting link speed and duplex\n");
goto out;
}

@@ -959,7 +958,7 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)
*/
ret_val = igb_force_mac_fc(hw);
if (ret_val) {
- hw_dbg("Error forcing flow control settings\n");
+ netdev_dbg(hw_netdev(hw), "Error forcing flow control settings\n");
goto out;
}
}
@@ -983,24 +982,22 @@ s32 igb_get_speed_and_duplex_copper(struct e1000_hw *hw, u16 *speed,
u32 status;

status = rd32(E1000_STATUS);
- if (status & E1000_STATUS_SPEED_1000) {
+ if (status & E1000_STATUS_SPEED_1000)
*speed = SPEED_1000;
- hw_dbg("1000 Mbs, ");
- } else if (status & E1000_STATUS_SPEED_100) {
+ else if (status & E1000_STATUS_SPEED_100)
*speed = SPEED_100;
- hw_dbg("100 Mbs, ");
- } else {
+ else
*speed = SPEED_10;
- hw_dbg("10 Mbs, ");
- }

- if (status & E1000_STATUS_FD) {
+ if (status & E1000_STATUS_FD)
*duplex = FULL_DUPLEX;
- hw_dbg("Full Duplex\n");
- } else {
+ else
*duplex = HALF_DUPLEX;
- hw_dbg("Half Duplex\n");
- }
+
+ netdev_dbg(hw_netdev(hw), "%u Mbps, %s Duplex\n",
+ (*speed == SPEED_1000) ? 1000 :
+ (*speed == SPEED_100) ? 100 : 10,
+ (*duplex == FULL_DUPLEX) ? "Full" : "Half");

return 0;
}
@@ -1029,7 +1026,7 @@ s32 igb_get_hw_semaphore(struct e1000_hw *hw)
}

if (i == timeout) {
- hw_dbg("Driver can't access device - SMBI bit is set.\n");
+ netdev_dbg(hw_netdev(hw), "Driver can't access device - SMBI bit is set\n");
ret_val = -E1000_ERR_NVM;
goto out;
}
@@ -1049,7 +1046,7 @@ s32 igb_get_hw_semaphore(struct e1000_hw *hw)
if (i == timeout) {
/* Release semaphores */
igb_put_hw_semaphore(hw);
- hw_dbg("Driver can't access the NVM\n");
+ netdev_dbg(hw_netdev(hw), "Driver can't access the NVM\n");
ret_val = -E1000_ERR_NVM;
goto out;
}
@@ -1095,7 +1092,7 @@ s32 igb_get_auto_rd_done(struct e1000_hw *hw)
}

if (i == AUTO_READ_DONE_TIMEOUT) {
- hw_dbg("Auto read by HW from NVM has not completed.\n");
+ netdev_dbg(hw_netdev(hw), "Auto read by HW from NVM has not completed\n");
ret_val = -E1000_ERR_RESET;
goto out;
}
@@ -1118,7 +1115,7 @@ static s32 igb_valid_led_default(struct e1000_hw *hw, u16 *data)

ret_val = hw->nvm.ops.read(hw, NVM_ID_LED_SETTINGS, 1, data);
if (ret_val) {
- hw_dbg("NVM Read Error\n");
+ netdev_dbg(hw_netdev(hw), "NVM Read Error\n");
goto out;
}

@@ -1294,7 +1291,7 @@ s32 igb_disable_pcie_master(struct e1000_hw *hw)
}

if (!timeout) {
- hw_dbg("Master requests are pending.\n");
+ netdev_dbg(hw_netdev(hw), "Master requests are pending\n");
ret_val = -E1000_ERR_MASTER_REQUESTS_PENDING;
goto out;
}
@@ -1315,7 +1312,7 @@ s32 igb_validate_mdi_setting(struct e1000_hw *hw)
s32 ret_val = 0;

if (!hw->mac.autoneg && (hw->phy.mdix == 0 || hw->phy.mdix == 3)) {
- hw_dbg("Invalid MDI setting detected\n");
+ netdev_dbg(hw_netdev(hw), "Invalid MDI setting detected\n");
hw->phy.mdix = 1;
ret_val = -E1000_ERR_CONFIG;
goto out;
@@ -1354,7 +1351,8 @@ s32 igb_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg,
break;
}
if (!(regvalue & E1000_GEN_CTL_READY)) {
- hw_dbg("Reg %08x did not indicate ready\n", reg);
+ netdev_dbg(hw_netdev(hw), "Reg %08x did not indicate ready\n",
+ reg);
ret_val = -E1000_ERR_PHY;
goto out;
}
diff --git a/drivers/net/igb/e1000_nvm.c b/drivers/net/igb/e1000_nvm.c
index d83b77f..c6b4dad 100644
--- a/drivers/net/igb/e1000_nvm.c
+++ b/drivers/net/igb/e1000_nvm.c
@@ -28,7 +28,7 @@
#include <linux/if_ether.h>
#include <linux/delay.h>

-#include "e1000_mac.h"
+#include "igb.h"
#include "e1000_nvm.h"

/**
@@ -200,7 +200,7 @@ s32 igb_acquire_nvm(struct e1000_hw *hw)
if (!timeout) {
eecd &= ~E1000_EECD_REQ;
wr32(E1000_EECD, eecd);
- hw_dbg("Could not acquire NVM grant\n");
+ netdev_dbg(hw_netdev(hw), "Could not acquire NVM grant\n");
ret_val = -E1000_ERR_NVM;
}

@@ -307,7 +307,7 @@ static s32 igb_ready_nvm_eeprom(struct e1000_hw *hw)
}

if (!timeout) {
- hw_dbg("SPI NVM Status error\n");
+ netdev_dbg(hw_netdev(hw), "SPI NVM Status error\n");
ret_val = -E1000_ERR_NVM;
goto out;
}
@@ -338,7 +338,7 @@ s32 igb_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
*/
if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) ||
(words == 0)) {
- hw_dbg("nvm parameter(s) out of bounds\n");
+ netdev_dbg(hw_netdev(hw), "nvm parameter(s) out of bounds\n");
ret_val = -E1000_ERR_NVM;
goto out;
}
@@ -384,7 +384,7 @@ s32 igb_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
*/
if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) ||
(words == 0)) {
- hw_dbg("nvm parameter(s) out of bounds\n");
+ netdev_dbg(hw_netdev(hw), "nvm parameter(s) out of bounds\n");
ret_val = -E1000_ERR_NVM;
goto out;
}
@@ -459,14 +459,14 @@ s32 igb_read_part_num(struct e1000_hw *hw, u32 *part_num)

ret_val = hw->nvm.ops.read(hw, NVM_PBA_OFFSET_0, 1, &nvm_data);
if (ret_val) {
- hw_dbg("NVM Read Error\n");
+ netdev_dbg(hw_netdev(hw), "NVM Read Error\n");
goto out;
}
*part_num = (u32)(nvm_data << 16);

ret_val = hw->nvm.ops.read(hw, NVM_PBA_OFFSET_1, 1, &nvm_data);
if (ret_val) {
- hw_dbg("NVM Read Error\n");
+ netdev_dbg(hw_netdev(hw), "NVM Read Error\n");
goto out;
}
*part_num |= nvm_data;
@@ -520,14 +520,14 @@ s32 igb_validate_nvm_checksum(struct e1000_hw *hw)
for (i = 0; i < (NVM_CHECKSUM_REG + 1); i++) {
ret_val = hw->nvm.ops.read(hw, i, 1, &nvm_data);
if (ret_val) {
- hw_dbg("NVM Read Error\n");
+ netdev_dbg(hw_netdev(hw), "NVM Read Error\n");
goto out;
}
checksum += nvm_data;
}

if (checksum != (u16) NVM_SUM) {
- hw_dbg("NVM Checksum Invalid\n");
+ netdev_dbg(hw_netdev(hw), "NVM Checksum Invalid\n");
ret_val = -E1000_ERR_NVM;
goto out;
}
@@ -553,7 +553,7 @@ s32 igb_update_nvm_checksum(struct e1000_hw *hw)
for (i = 0; i < NVM_CHECKSUM_REG; i++) {
ret_val = hw->nvm.ops.read(hw, i, 1, &nvm_data);
if (ret_val) {
- hw_dbg("NVM Read Error while updating checksum.\n");
+ netdev_dbg(hw_netdev(hw), "NVM Read Error while updating checksum\n");
goto out;
}
checksum += nvm_data;
@@ -561,7 +561,7 @@ s32 igb_update_nvm_checksum(struct e1000_hw *hw)
checksum = (u16) NVM_SUM - checksum;
ret_val = hw->nvm.ops.write(hw, NVM_CHECKSUM_REG, 1, &checksum);
if (ret_val)
- hw_dbg("NVM Write Error while updating checksum.\n");
+ netdev_dbg(hw_netdev(hw), "NVM Write Error while updating checksum\n");

out:
return ret_val;
diff --git a/drivers/net/igb/e1000_phy.c b/drivers/net/igb/e1000_phy.c
index cf1f323..cafb8a0 100644
--- a/drivers/net/igb/e1000_phy.c
+++ b/drivers/net/igb/e1000_phy.c
@@ -28,7 +28,7 @@
#include <linux/if_ether.h>
#include <linux/delay.h>

-#include "e1000_mac.h"
+#include "igb.h"
#include "e1000_phy.h"

static s32 igb_phy_setup_autoneg(struct e1000_hw *hw);
@@ -143,7 +143,7 @@ s32 igb_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data)
s32 ret_val = 0;

if (offset > MAX_PHY_REG_ADDRESS) {
- hw_dbg("PHY Address %d is out of range\n", offset);
+ netdev_dbg(hw_netdev(hw), "PHY Address %d is out of range\n", offset);
ret_val = -E1000_ERR_PARAM;
goto out;
}
@@ -171,12 +171,12 @@ s32 igb_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data)
break;
}
if (!(mdic & E1000_MDIC_READY)) {
- hw_dbg("MDI Read did not complete\n");
+ netdev_dbg(hw_netdev(hw), "MDI Read did not complete\n");
ret_val = -E1000_ERR_PHY;
goto out;
}
if (mdic & E1000_MDIC_ERROR) {
- hw_dbg("MDI Error\n");
+ netdev_dbg(hw_netdev(hw), "MDI Error\n");
ret_val = -E1000_ERR_PHY;
goto out;
}
@@ -201,7 +201,8 @@ s32 igb_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data)
s32 ret_val = 0;

if (offset > MAX_PHY_REG_ADDRESS) {
- hw_dbg("PHY Address %d is out of range\n", offset);
+ netdev_dbg(hw_netdev(hw), "PHY Address %d is out of range\n",
+ offset);
ret_val = -E1000_ERR_PARAM;
goto out;
}
@@ -230,12 +231,12 @@ s32 igb_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data)
break;
}
if (!(mdic & E1000_MDIC_READY)) {
- hw_dbg("MDI Write did not complete\n");
+ netdev_dbg(hw_netdev(hw), "MDI Write did not complete\n");
ret_val = -E1000_ERR_PHY;
goto out;
}
if (mdic & E1000_MDIC_ERROR) {
- hw_dbg("MDI Error\n");
+ netdev_dbg(hw_netdev(hw), "MDI Error\n");
ret_val = -E1000_ERR_PHY;
goto out;
}
@@ -278,11 +279,11 @@ s32 igb_read_phy_reg_i2c(struct e1000_hw *hw, u32 offset, u16 *data)
break;
}
if (!(i2ccmd & E1000_I2CCMD_READY)) {
- hw_dbg("I2CCMD Read did not complete\n");
+ netdev_dbg(hw_netdev(hw), "I2CCMD Read did not complete\n");
return -E1000_ERR_PHY;
}
if (i2ccmd & E1000_I2CCMD_ERROR) {
- hw_dbg("I2CCMD Error bit set\n");
+ netdev_dbg(hw_netdev(hw), "I2CCMD Error bit set\n");
return -E1000_ERR_PHY;
}

@@ -330,11 +331,11 @@ s32 igb_write_phy_reg_i2c(struct e1000_hw *hw, u32 offset, u16 data)
break;
}
if (!(i2ccmd & E1000_I2CCMD_READY)) {
- hw_dbg("I2CCMD Write did not complete\n");
+ netdev_dbg(hw_netdev(hw), "I2CCMD Write did not complete\n");
return -E1000_ERR_PHY;
}
if (i2ccmd & E1000_I2CCMD_ERROR) {
- hw_dbg("I2CCMD Error bit set\n");
+ netdev_dbg(hw_netdev(hw), "I2CCMD Error bit set\n");
return -E1000_ERR_PHY;
}

@@ -441,7 +442,7 @@ s32 igb_copper_link_setup_82580(struct e1000_hw *hw)
if (phy->type == e1000_phy_82580) {
ret_val = hw->phy.ops.reset(hw);
if (ret_val) {
- hw_dbg("Error resetting the PHY.\n");
+ netdev_dbg(hw_netdev(hw), "Error resetting the PHY\n");
goto out;
}
}
@@ -561,7 +562,7 @@ s32 igb_copper_link_setup_m88(struct e1000_hw *hw)
/* Commit the changes. */
ret_val = igb_phy_sw_reset(hw);
if (ret_val) {
- hw_dbg("Error committing the PHY changes\n");
+ netdev_dbg(hw_netdev(hw), "Error committing the PHY changes\n");
goto out;
}

@@ -589,7 +590,7 @@ s32 igb_copper_link_setup_igp(struct e1000_hw *hw)

ret_val = phy->ops.reset(hw);
if (ret_val) {
- hw_dbg("Error resetting the PHY.\n");
+ netdev_dbg(hw_netdev(hw), "Error resetting the PHY\n");
goto out;
}

@@ -608,7 +609,7 @@ s32 igb_copper_link_setup_igp(struct e1000_hw *hw)
if (phy->ops.set_d3_lplu_state)
ret_val = phy->ops.set_d3_lplu_state(hw, false);
if (ret_val) {
- hw_dbg("Error Disabling LPLU D3\n");
+ netdev_dbg(hw_netdev(hw), "Error Disabling LPLU D3\n");
goto out;
}
}
@@ -616,7 +617,7 @@ s32 igb_copper_link_setup_igp(struct e1000_hw *hw)
/* disable lplu d0 during driver init */
ret_val = phy->ops.set_d0_lplu_state(hw, false);
if (ret_val) {
- hw_dbg("Error Disabling LPLU D0\n");
+ netdev_dbg(hw_netdev(hw), "Error Disabling LPLU D0\n");
goto out;
}
/* Configure mdi-mdix settings */
@@ -736,13 +737,13 @@ static s32 igb_copper_link_autoneg(struct e1000_hw *hw)
if (phy->autoneg_advertised == 0)
phy->autoneg_advertised = phy->autoneg_mask;

- hw_dbg("Reconfiguring auto-neg advertisement params\n");
+ netdev_dbg(hw_netdev(hw), "Reconfiguring auto-neg advertisement params\n");
ret_val = igb_phy_setup_autoneg(hw);
if (ret_val) {
- hw_dbg("Error Setting up Auto-Negotiation\n");
+ netdev_dbg(hw_netdev(hw), "Error Setting up Auto-Negotiation\n");
goto out;
}
- hw_dbg("Restarting Auto-Neg\n");
+ netdev_dbg(hw_netdev(hw), "Restarting Auto-Neg\n");

/*
* Restart auto-negotiation by setting the Auto Neg Enable bit and
@@ -764,8 +765,7 @@ static s32 igb_copper_link_autoneg(struct e1000_hw *hw)
if (phy->autoneg_wait_to_complete) {
ret_val = igb_wait_autoneg(hw);
if (ret_val) {
- hw_dbg("Error while waiting for "
- "autoneg to complete\n");
+ netdev_dbg(hw_netdev(hw), "Error while waiting for autoneg to complete\n");
goto out;
}
}
@@ -826,39 +826,40 @@ static s32 igb_phy_setup_autoneg(struct e1000_hw *hw)
NWAY_AR_10T_HD_CAPS);
mii_1000t_ctrl_reg &= ~(CR_1000T_HD_CAPS | CR_1000T_FD_CAPS);

- hw_dbg("autoneg_advertised %x\n", phy->autoneg_advertised);
+ netdev_dbg(hw_netdev(hw), "autoneg_advertised %x\n",
+ phy->autoneg_advertised);

/* Do we want to advertise 10 Mb Half Duplex? */
if (phy->autoneg_advertised & ADVERTISE_10_HALF) {
- hw_dbg("Advertise 10mb Half duplex\n");
+ netdev_dbg(hw_netdev(hw), "Advertise 10mb Half duplex\n");
mii_autoneg_adv_reg |= NWAY_AR_10T_HD_CAPS;
}

/* Do we want to advertise 10 Mb Full Duplex? */
if (phy->autoneg_advertised & ADVERTISE_10_FULL) {
- hw_dbg("Advertise 10mb Full duplex\n");
+ netdev_dbg(hw_netdev(hw), "Advertise 10mb Full duplex\n");
mii_autoneg_adv_reg |= NWAY_AR_10T_FD_CAPS;
}

/* Do we want to advertise 100 Mb Half Duplex? */
if (phy->autoneg_advertised & ADVERTISE_100_HALF) {
- hw_dbg("Advertise 100mb Half duplex\n");
+ netdev_dbg(hw_netdev(hw), "Advertise 100mb Half duplex\n");
mii_autoneg_adv_reg |= NWAY_AR_100TX_HD_CAPS;
}

/* Do we want to advertise 100 Mb Full Duplex? */
if (phy->autoneg_advertised & ADVERTISE_100_FULL) {
- hw_dbg("Advertise 100mb Full duplex\n");
+ netdev_dbg(hw_netdev(hw), "Advertise 100mb Full duplex\n");
mii_autoneg_adv_reg |= NWAY_AR_100TX_FD_CAPS;
}

/* We do not allow the Phy to advertise 1000 Mb Half Duplex */
if (phy->autoneg_advertised & ADVERTISE_1000_HALF)
- hw_dbg("Advertise 1000mb Half duplex request denied!\n");
+ netdev_dbg(hw_netdev(hw), "Advertise 1000mb Half duplex request denied!\n");

/* Do we want to advertise 1000 Mb Full Duplex? */
if (phy->autoneg_advertised & ADVERTISE_1000_FULL) {
- hw_dbg("Advertise 1000mb Full duplex\n");
+ netdev_dbg(hw_netdev(hw), "Advertise 1000mb Full duplex\n");
mii_1000t_ctrl_reg |= CR_1000T_FD_CAPS;
}

@@ -917,7 +918,7 @@ static s32 igb_phy_setup_autoneg(struct e1000_hw *hw)
mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE);
break;
default:
- hw_dbg("Flow control param set incorrectly\n");
+ netdev_dbg(hw_netdev(hw), "Flow control param set incorrectly\n");
ret_val = -E1000_ERR_CONFIG;
goto out;
}
@@ -926,7 +927,8 @@ static s32 igb_phy_setup_autoneg(struct e1000_hw *hw)
if (ret_val)
goto out;

- hw_dbg("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg);
+ netdev_dbg(hw_netdev(hw), "Auto-Neg Advertising %x\n",
+ mii_autoneg_adv_reg);

if (phy->autoneg_mask & ADVERTISE_1000_FULL) {
ret_val = phy->ops.write_reg(hw,
@@ -968,10 +970,10 @@ s32 igb_setup_copper_link(struct e1000_hw *hw)
* PHY will be set to 10H, 10F, 100H or 100F
* depending on user settings.
*/
- hw_dbg("Forcing Speed and Duplex\n");
+ netdev_dbg(hw_netdev(hw), "Forcing Speed and Duplex\n");
ret_val = hw->phy.ops.force_speed_duplex(hw);
if (ret_val) {
- hw_dbg("Error Forcing Speed and Duplex\n");
+ netdev_dbg(hw_netdev(hw), "Error Forcing Speed and Duplex\n");
goto out;
}
}
@@ -988,11 +990,11 @@ s32 igb_setup_copper_link(struct e1000_hw *hw)
goto out;

if (link) {
- hw_dbg("Valid link established!!!\n");
+ netdev_dbg(hw_netdev(hw), "Valid link established!!!\n");
igb_config_collision_dist(hw);
ret_val = igb_config_fc_after_link_up(hw);
} else {
- hw_dbg("Unable to establish link!!!\n");
+ netdev_dbg(hw_netdev(hw), "Unable to establish link!!!\n");
}

out:
@@ -1039,12 +1041,12 @@ s32 igb_phy_force_speed_duplex_igp(struct e1000_hw *hw)
if (ret_val)
goto out;

- hw_dbg("IGP PSCR: %X\n", phy_data);
+ netdev_dbg(hw_netdev(hw), "IGP PSCR: %X\n", phy_data);

udelay(1);

if (phy->autoneg_wait_to_complete) {
- hw_dbg("Waiting for forced speed/duplex link on IGP phy.\n");
+ netdev_dbg(hw_netdev(hw), "Waiting for forced speed/duplex link on IGP phy\n");

ret_val = igb_phy_has_link(hw,
PHY_FORCE_LIMIT,
@@ -1054,7 +1056,7 @@ s32 igb_phy_force_speed_duplex_igp(struct e1000_hw *hw)
goto out;

if (!link)
- hw_dbg("Link taking longer than expected.\n");
+ netdev_dbg(hw_netdev(hw), "Link taking longer than expected\n");

/* Try once more */
ret_val = igb_phy_has_link(hw,
@@ -1099,7 +1101,7 @@ s32 igb_phy_force_speed_duplex_m88(struct e1000_hw *hw)
if (ret_val)
goto out;

- hw_dbg("M88E1000 PSCR: %X\n", phy_data);
+ netdev_dbg(hw_netdev(hw), "M88E1000 PSCR: %X\n", phy_data);

ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_data);
if (ret_val)
@@ -1117,7 +1119,7 @@ s32 igb_phy_force_speed_duplex_m88(struct e1000_hw *hw)
goto out;

if (phy->autoneg_wait_to_complete) {
- hw_dbg("Waiting for forced speed/duplex link on M88 phy.\n");
+ netdev_dbg(hw_netdev(hw), "Waiting for forced speed/duplex link on M88 phy\n");

ret_val = igb_phy_has_link(hw, PHY_FORCE_LIMIT, 100000, &link);
if (ret_val)
@@ -1210,11 +1212,11 @@ static void igb_phy_force_speed_duplex_setup(struct e1000_hw *hw,
if (mac->forced_speed_duplex & E1000_ALL_HALF_DUPLEX) {
ctrl &= ~E1000_CTRL_FD;
*phy_ctrl &= ~MII_CR_FULL_DUPLEX;
- hw_dbg("Half Duplex\n");
+ netdev_dbg(hw_netdev(hw), "Half Duplex\n");
} else {
ctrl |= E1000_CTRL_FD;
*phy_ctrl |= MII_CR_FULL_DUPLEX;
- hw_dbg("Full Duplex\n");
+ netdev_dbg(hw_netdev(hw), "Full Duplex\n");
}

/* Forcing 10mb or 100mb? */
@@ -1222,12 +1224,12 @@ static void igb_phy_force_speed_duplex_setup(struct e1000_hw *hw,
ctrl |= E1000_CTRL_SPD_100;
*phy_ctrl |= MII_CR_SPEED_100;
*phy_ctrl &= ~(MII_CR_SPEED_1000 | MII_CR_SPEED_10);
- hw_dbg("Forcing 100mb\n");
+ netdev_dbg(hw_netdev(hw), "Forcing 100mb\n");
} else {
ctrl &= ~(E1000_CTRL_SPD_1000 | E1000_CTRL_SPD_100);
*phy_ctrl |= MII_CR_SPEED_10;
*phy_ctrl &= ~(MII_CR_SPEED_1000 | MII_CR_SPEED_100);
- hw_dbg("Forcing 10mb\n");
+ netdev_dbg(hw_netdev(hw), "Forcing 10mb\n");
}

igb_config_collision_dist(hw);
@@ -1647,7 +1649,7 @@ s32 igb_get_phy_info_m88(struct e1000_hw *hw)
bool link;

if (phy->media_type != e1000_media_type_copper) {
- hw_dbg("Phy info is only valid for copper media\n");
+ netdev_dbg(hw_netdev(hw), "Phy info is only valid for copper media\n");
ret_val = -E1000_ERR_CONFIG;
goto out;
}
@@ -1657,7 +1659,7 @@ s32 igb_get_phy_info_m88(struct e1000_hw *hw)
goto out;

if (!link) {
- hw_dbg("Phy info is only valid if link is up\n");
+ netdev_dbg(hw_netdev(hw), "Phy info is only valid if link is up\n");
ret_val = -E1000_ERR_CONFIG;
goto out;
}
@@ -1727,7 +1729,7 @@ s32 igb_get_phy_info_igp(struct e1000_hw *hw)
goto out;

if (!link) {
- hw_dbg("Phy info is only valid if link is up\n");
+ netdev_dbg(hw_netdev(hw), "Phy info is only valid if link is up\n");
ret_val = -E1000_ERR_CONFIG;
goto out;
}
@@ -1853,7 +1855,7 @@ out:
**/
s32 igb_phy_init_script_igp3(struct e1000_hw *hw)
{
- hw_dbg("Running IGP 3 PHY init script\n");
+ netdev_dbg(hw_netdev(hw), "Running IGP 3 PHY init script\n");

/* PHY init IGP 3 */
/* Enable rise/fall, 10-mode work in class-A */
@@ -2031,12 +2033,12 @@ s32 igb_phy_force_speed_duplex_82580(struct e1000_hw *hw)
if (ret_val)
goto out;

- hw_dbg("I82580_PHY_CTRL_2: %X\n", phy_data);
+ netdev_dbg(hw_netdev(hw), "I82580_PHY_CTRL_2: %X\n", phy_data);

udelay(1);

if (phy->autoneg_wait_to_complete) {
- hw_dbg("Waiting for forced speed/duplex link on 82580 phy\n");
+ netdev_dbg(hw_netdev(hw), "Waiting for forced speed/duplex link on 82580 phy\n");

ret_val = igb_phy_has_link(hw,
PHY_FORCE_LIMIT,
@@ -2046,7 +2048,7 @@ s32 igb_phy_force_speed_duplex_82580(struct e1000_hw *hw)
goto out;

if (!link)
- hw_dbg("Link taking longer than expected.\n");
+ netdev_dbg(hw_netdev(hw), "Link taking longer than expected\n");

/* Try once more */
ret_val = igb_phy_has_link(hw,
@@ -2083,7 +2085,7 @@ s32 igb_get_phy_info_82580(struct e1000_hw *hw)
goto out;

if (!link) {
- hw_dbg("Phy info is only valid if link is up\n");
+ netdev_dbg(hw_netdev(hw), "Phy info is only valid if link is up\n");
ret_val = -E1000_ERR_CONFIG;
goto out;
}
diff --git a/drivers/net/igb/igb.h b/drivers/net/igb/igb.h
index a177570..191a794 100644
--- a/drivers/net/igb/igb.h
+++ b/drivers/net/igb/igb.h
@@ -337,7 +337,6 @@ enum igb_boards {
extern char igb_driver_name[];
extern char igb_driver_version[];

-extern char *igb_get_hw_dev_name(struct e1000_hw *hw);
extern int igb_up(struct igb_adapter *);
extern void igb_down(struct igb_adapter *);
extern void igb_reinit_locked(struct igb_adapter *);
diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c
index a4cead1..20a4ce8 100644
--- a/drivers/net/igb/igb_ethtool.c
+++ b/drivers/net/igb/igb_ethtool.c
@@ -200,8 +200,7 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
/* When SoL/IDER sessions are active, autoneg/speed/duplex
* cannot be changed */
if (igb_check_reset_block(hw)) {
- dev_err(&adapter->pdev->dev, "Cannot change link "
- "characteristics when SoL/IDER is active.\n");
+ dev_err(&adapter->pdev->dev, "Cannot change link characteristics when SoL/IDER is active\n");
return -EINVAL;
}

@@ -1656,8 +1655,7 @@ static int igb_loopback_test(struct igb_adapter *adapter, u64 *data)
* sessions are active */
if (igb_check_reset_block(&adapter->hw)) {
dev_err(&adapter->pdev->dev,
- "Cannot do PHY loopback test "
- "when SoL/IDER is active.\n");
+ "Cannot do PHY loopback test when SoL/IDER is active\n");
*data = 0;
goto out;
}
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index f588e49..e1a7e9e 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -25,6 +25,8 @@

*******************************************************************************/

+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include <linux/module.h>
#include <linux/types.h>
#include <linux/init.h>
@@ -223,16 +225,6 @@ static cycle_t igb_read_clock(const struct cyclecounter *tc)

#ifdef DEBUG
/**
- * igb_get_hw_dev_name - return device name string
- * used by hardware layer to print debugging information
- **/
-char *igb_get_hw_dev_name(struct e1000_hw *hw)
-{
- struct igb_adapter *adapter = hw->back;
- return adapter->netdev->name;
-}
-
-/**
* igb_get_time_str - format current NIC and system time as string
*/
static char *igb_get_time_str(struct igb_adapter *adapter,
@@ -266,10 +258,8 @@ static char *igb_get_time_str(struct igb_adapter *adapter,
static int __init igb_init_module(void)
{
int ret;
- printk(KERN_INFO "%s - version %s\n",
- igb_driver_string, igb_driver_version);
-
- printk(KERN_INFO "%s\n", igb_copyright);
+ pr_info("version %s\n", igb_driver_version);
+ pr_info("%s\n", igb_copyright);

#ifdef CONFIG_IGB_DCA
dca_register_notify(&dca_notifier);
@@ -1513,7 +1503,7 @@ static int __devinit igb_probe(struct pci_dev *pdev,

if (igb_check_reset_block(hw))
dev_info(&pdev->dev,
- "PHY reset is blocked due to SOL/IDER session.\n");
+ "PHY reset is blocked due to SOL/IDER session\n");

netdev->features = NETIF_F_SG |
NETIF_F_IP_CSUM |
@@ -3106,8 +3096,8 @@ static void igb_watchdog_task(struct work_struct *work)
"Full Duplex" : "Half Duplex",
((ctrl & E1000_CTRL_TFCE) &&
(ctrl & E1000_CTRL_RFCE)) ? "RX/TX" :
- ((ctrl & E1000_CTRL_RFCE) ? "RX" :
- ((ctrl & E1000_CTRL_TFCE) ? "TX" : "None")));
+ (ctrl & E1000_CTRL_RFCE) ? "RX" :
+ (ctrl & E1000_CTRL_TFCE) ? "TX" : "None");

/* tweak tx_queue_len according to speed/duplex and
* adjust the timeout factor */
@@ -3913,7 +3903,7 @@ static int igb_change_mtu(struct net_device *netdev, int new_mtu)
}

if (max_frame > MAX_STD_JUMBO_FRAME_SIZE) {
- dev_err(&pdev->dev, "MTU > 9216 not supported.\n");
+ dev_err(&pdev->dev, "MTU > 9216 not supported\n");
return -EINVAL;
}

@@ -4561,11 +4551,9 @@ static int igb_ndo_set_vf_vlan(struct net_device *netdev,
"Setting VLAN %d, QOS 0x%x on VF %d\n", vlan, qos, vf);
if (test_bit(__IGB_DOWN, &adapter->state)) {
dev_warn(&adapter->pdev->dev,
- "The VF VLAN has been set,"
- " but the PF device is not up.\n");
+ "The VF VLAN has been set, but the PF device is not up\n");
dev_warn(&adapter->pdev->dev,
- "Bring the PF device up before"
- " attempting to use the VF device.\n");
+ "Bring the PF device up before attempting to use the VF device\n");
}
} else {
igb_vlvf_set(adapter, adapter->vf_data[vf].pf_vlan,
@@ -6004,7 +5992,7 @@ static pci_ers_result_t igb_io_slot_reset(struct pci_dev *pdev)

if (pci_enable_device_mem(pdev)) {
dev_err(&pdev->dev,
- "Cannot re-enable PCI device after reset.\n");
+ "Cannot re-enable PCI device after reset\n");
result = PCI_ERS_RESULT_DISCONNECT;
} else {
pci_set_master(pdev);
@@ -6105,13 +6093,10 @@ static int igb_ndo_set_vf_mac(struct net_device *netdev, int vf, u8 *mac)
return -EINVAL;
adapter->vf_data[vf].flags |= IGB_VF_FLAG_PF_SET_MAC;
dev_info(&adapter->pdev->dev, "setting MAC %pM on VF %d\n", mac, vf);
- dev_info(&adapter->pdev->dev, "Reload the VF driver to make this"
- " change effective.");
+ dev_info(&adapter->pdev->dev, "Reload the VF driver to make this change effective.\n");
if (test_bit(__IGB_DOWN, &adapter->state)) {
- dev_warn(&adapter->pdev->dev, "The VF MAC address has been set,"
- " but the PF device is not up.\n");
- dev_warn(&adapter->pdev->dev, "Bring the PF device up before"
- " attempting to use the VF device.\n");
+ dev_warn(&adapter->pdev->dev, "The VF MAC address has been set, but the PF device is not up.\n");
+ dev_warn(&adapter->pdev->dev, "Bring the PF device up before attempting to use the VF device.\n");
}
return igb_set_vf_mac(adapter, vf, mac);
}
--
1.7.0.14.g7e948

2010-02-23 02:57:29

by Joe Perches

[permalink] [raw]
Subject: [PATCH net-next 6/7] drivers/net/e1000e: Use pr_<level> and netdev_<level>

Convert e_<level> to netdev_<level>
Remove #define PFX
Use #define pr_fmt
Convert a few printks to pr_<level>
Coalesce long formats
Typo spelling fix

Signed-off-by: Joe Perches <[email protected]>
---
drivers/net/e1000e/82571.c | 57 +++++++++++-------
drivers/net/e1000e/e1000.h | 21 -------
drivers/net/e1000e/es2lan.c | 27 +++++----
drivers/net/e1000e/ethtool.c | 37 ++++++------
drivers/net/e1000e/ich8lan.c | 90 +++++++++++++++++------------
drivers/net/e1000e/lib.c | 131 +++++++++++++++++++++---------------------
drivers/net/e1000e/netdev.c | 95 +++++++++++++++---------------
drivers/net/e1000e/param.c | 20 +++---
drivers/net/e1000e/phy.c | 114 ++++++++++++++++++------------------
9 files changed, 302 insertions(+), 290 deletions(-)

diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c
index 3c95acb..a5fefb6 100644
--- a/drivers/net/e1000e/82571.c
+++ b/drivers/net/e1000e/82571.c
@@ -317,13 +317,14 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter)
* indicates that the bootagent or EFI code has
* improperly left this bit enabled
*/
- e_dbg("Please update your 82571 Bootagent\n");
+ netdev_dbg(adapter->netdev,
+ "Please update your 82571 Bootagent\n");
}
ew32(SWSM, swsm & ~E1000_SWSM_SMBI);
}

/*
- * Initialze device specific counter of SMBI acquisition
+ * Initialize device specific counter of SMBI acquisition
* timeouts.
*/
hw->dev_spec.e82571.smb_counter = 0;
@@ -491,7 +492,8 @@ static s32 e1000_get_hw_semaphore_82571(struct e1000_hw *hw)
}

if (i == sw_timeout) {
- e_dbg("Driver can't access device - SMBI bit is set.\n");
+ netdev_dbg(hw->adapter->netdev,
+ "Driver can't access device - SMBI bit is set\n");
hw->dev_spec.e82571.smb_counter++;
}
/* Get the FW semaphore. */
@@ -509,7 +511,7 @@ static s32 e1000_get_hw_semaphore_82571(struct e1000_hw *hw)
if (i == fw_timeout) {
/* Release semaphores */
e1000_put_hw_semaphore_82571(hw);
- e_dbg("Driver can't access the NVM\n");
+ netdev_dbg(hw->adapter->netdev, "Driver can't access the NVM\n");
return -E1000_ERR_NVM;
}

@@ -715,7 +717,8 @@ static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset,
*/
if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) ||
(words == 0)) {
- e_dbg("nvm parameter(s) out of bounds\n");
+ netdev_dbg(hw->adapter->netdev,
+ "nvm parameter(s) out of bounds\n");
return -E1000_ERR_NVM;
}

@@ -756,7 +759,8 @@ static s32 e1000_get_cfg_done_82571(struct e1000_hw *hw)
timeout--;
}
if (!timeout) {
- e_dbg("MNG configuration cycle has not completed.\n");
+ netdev_dbg(hw->adapter->netdev,
+ "MNG configuration cycle has not completed\n");
return -E1000_ERR_RESET;
}

@@ -851,9 +855,10 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
*/
ret_val = e1000e_disable_pcie_master(hw);
if (ret_val)
- e_dbg("PCI-E Master disable polling has failed.\n");
+ netdev_dbg(hw->adapter->netdev,
+ "PCI-E Master disable polling has failed\n");

- e_dbg("Masking off all interrupts\n");
+ netdev_dbg(hw->adapter->netdev, "Masking off all interrupts\n");
ew32(IMC, 0xffffffff);

ew32(RCTL, 0);
@@ -892,7 +897,7 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)

ctrl = er32(CTRL);

- e_dbg("Issuing a global reset to MAC\n");
+ netdev_dbg(hw->adapter->netdev, "Issuing a global reset to MAC\n");
ew32(CTRL, ctrl | E1000_CTRL_RST);

if (hw->nvm.type == e1000_nvm_flash_hw) {
@@ -960,11 +965,12 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw)
/* Initialize identification LED */
ret_val = e1000e_id_led_init(hw);
if (ret_val)
- e_dbg("Error initializing identification LED\n");
+ netdev_dbg(hw->adapter->netdev,
+ "Error initializing identification LED\n");
/* This is not fatal and we should not stop init due to this */

/* Disabling VLAN filtering */
- e_dbg("Initializing the IEEE VLAN\n");
+ netdev_dbg(hw->adapter->netdev, "Initializing the IEEE VLAN\n");
mac->ops.clear_vfta(hw);

/* Setup the receive address. */
@@ -978,7 +984,7 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw)
e1000e_init_rx_addrs(hw, rar_count);

/* Zero out the Multicast HASH table */
- e_dbg("Zeroing the MTA\n");
+ netdev_dbg(hw->adapter->netdev, "Zeroing the MTA\n");
for (i = 0; i < mac->mta_reg_count; i++)
E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0);

@@ -1375,7 +1381,8 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw)
mac->serdes_link_state =
e1000_serdes_link_autoneg_progress;
mac->serdes_has_link = false;
- e_dbg("AN_UP -> AN_PROG\n");
+ netdev_dbg(hw->adapter->netdev,
+ "AN_UP -> AN_PROG\n");
}
break;

@@ -1393,7 +1400,8 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw)
mac->serdes_link_state =
e1000_serdes_link_autoneg_progress;
mac->serdes_has_link = false;
- e_dbg("FORCED_UP -> AN_PROG\n");
+ netdev_dbg(hw->adapter->netdev,
+ "FORCED_UP -> AN_PROG\n");
}
break;

@@ -1407,13 +1415,15 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw)
if (status & E1000_STATUS_LU) {
mac->serdes_link_state =
e1000_serdes_link_autoneg_complete;
- e_dbg("AN_PROG -> AN_UP\n");
+ netdev_dbg(hw->adapter->netdev,
+ "AN_PROG -> AN_UP\n");
mac->serdes_has_link = true;
} else {
/* Autoneg completed, but failed. */
mac->serdes_link_state =
e1000_serdes_link_down;
- e_dbg("AN_PROG -> DOWN\n");
+ netdev_dbg(hw->adapter->netdev,
+ "AN_PROG -> DOWN\n");
}
} else {
/*
@@ -1428,13 +1438,15 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw)
/* Configure Flow Control after link up. */
ret_val = e1000e_config_fc_after_link_up(hw);
if (ret_val) {
- e_dbg("Error config flow control\n");
+ netdev_dbg(hw->adapter->netdev,
+ "Error config flow control\n");
break;
}
mac->serdes_link_state =
e1000_serdes_link_forced_up;
mac->serdes_has_link = true;
- e_dbg("AN_PROG -> FORCED_UP\n");
+ netdev_dbg(hw->adapter->netdev,
+ "AN_PROG -> FORCED_UP\n");
}
break;

@@ -1449,14 +1461,14 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw)
ew32(CTRL, (ctrl & ~E1000_CTRL_SLU));
mac->serdes_link_state =
e1000_serdes_link_autoneg_progress;
- e_dbg("DOWN -> AN_PROG\n");
+ netdev_dbg(hw->adapter->netdev, "DOWN -> AN_PROG\n");
break;
}
} else {
if (!(rxcw & E1000_RXCW_SYNCH)) {
mac->serdes_has_link = false;
mac->serdes_link_state = e1000_serdes_link_down;
- e_dbg("ANYSTATE -> DOWN\n");
+ netdev_dbg(hw->adapter->netdev, "ANYSTATE -> DOWN\n");
} else {
/*
* We have sync, and can tolerate one invalid (IV)
@@ -1468,7 +1480,8 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw)
if (rxcw & E1000_RXCW_IV) {
mac->serdes_link_state = e1000_serdes_link_down;
mac->serdes_has_link = false;
- e_dbg("ANYSTATE -> DOWN\n");
+ netdev_dbg(hw->adapter->netdev,
+ "ANYSTATE -> DOWN\n");
}
}
}
@@ -1490,7 +1503,7 @@ static s32 e1000_valid_led_default_82571(struct e1000_hw *hw, u16 *data)

ret_val = e1000_read_nvm(hw, NVM_ID_LED_SETTINGS, 1, data);
if (ret_val) {
- e_dbg("NVM Read Error\n");
+ netdev_dbg(hw->adapter->netdev, "NVM Read Error\n");
return ret_val;
}

diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h
index c2ec095..3df5648 100644
--- a/drivers/net/e1000e/e1000.h
+++ b/drivers/net/e1000e/e1000.h
@@ -42,27 +42,6 @@

struct e1000_info;

-#define e_printk(level, adapter, format, arg...) \
- printk(level "%s: %s: " format, pci_name(adapter->pdev), \
- adapter->netdev->name, ## arg)
-
-#ifdef DEBUG
-#define e_dbg(format, arg...) \
- e_printk(KERN_DEBUG , hw->adapter, format, ## arg)
-#else
-#define e_dbg(format, arg...) do { (void)(hw); } while (0)
-#endif
-
-#define e_err(format, arg...) \
- e_printk(KERN_ERR, adapter, format, ## arg)
-#define e_info(format, arg...) \
- e_printk(KERN_INFO, adapter, format, ## arg)
-#define e_warn(format, arg...) \
- e_printk(KERN_WARNING, adapter, format, ## arg)
-#define e_notice(format, arg...) \
- e_printk(KERN_NOTICE, adapter, format, ## arg)
-
-
/* Interrupt modes, as used by the IntMode parameter */
#define E1000E_INT_MODE_LEGACY 0
#define E1000E_INT_MODE_MSI 1
diff --git a/drivers/net/e1000e/es2lan.c b/drivers/net/e1000e/es2lan.c
index 27d2158..814511d 100644
--- a/drivers/net/e1000e/es2lan.c
+++ b/drivers/net/e1000e/es2lan.c
@@ -399,7 +399,8 @@ static s32 e1000_acquire_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask)
}

if (i == timeout) {
- e_dbg("Driver can't access resource, SW_FW_SYNC timeout.\n");
+ netdev_dbg(hw->adapter->netdev,
+ "Driver can't access resource, SW_FW_SYNC timeout\n");
return -E1000_ERR_SWFW_SYNC;
}

@@ -613,7 +614,8 @@ static s32 e1000_get_cfg_done_80003es2lan(struct e1000_hw *hw)
timeout--;
}
if (!timeout) {
- e_dbg("MNG configuration cycle has not completed.\n");
+ netdev_dbg(hw->adapter->netdev,
+ "MNG configuration cycle has not completed\n");
return -E1000_ERR_RESET;
}

@@ -646,7 +648,7 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw)
if (ret_val)
return ret_val;

- e_dbg("GG82563 PSCR: %X\n", phy_data);
+ netdev_dbg(hw->adapter->netdev, "GG82563 PSCR: %X\n", phy_data);

ret_val = e1e_rphy(hw, PHY_CONTROL, &phy_data);
if (ret_val)
@@ -664,8 +666,8 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw)
udelay(1);

if (hw->phy.autoneg_wait_to_complete) {
- e_dbg("Waiting for forced speed/duplex link "
- "on GG82563 phy.\n");
+ netdev_dbg(hw->adapter->netdev,
+ "Waiting for forced speed/duplex link on GG82563 phy\n");

ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT,
100000, &link);
@@ -790,9 +792,10 @@ static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw)
*/
ret_val = e1000e_disable_pcie_master(hw);
if (ret_val)
- e_dbg("PCI-E Master disable polling has failed.\n");
+ netdev_dbg(hw->adapter->netdev,
+ "PCI-E Master disable polling has failed\n");

- e_dbg("Masking off all interrupts\n");
+ netdev_dbg(hw->adapter->netdev, "Masking off all interrupts\n");
ew32(IMC, 0xffffffff);

ew32(RCTL, 0);
@@ -804,7 +807,7 @@ static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw)
ctrl = er32(CTRL);

ret_val = e1000_acquire_phy_80003es2lan(hw);
- e_dbg("Issuing a global reset to MAC\n");
+ netdev_dbg(hw->adapter->netdev, "Issuing a global reset to MAC\n");
ew32(CTRL, ctrl | E1000_CTRL_RST);
e1000_release_phy_80003es2lan(hw);

@@ -840,18 +843,18 @@ static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw)
/* Initialize identification LED */
ret_val = e1000e_id_led_init(hw);
if (ret_val)
- e_dbg("Error initializing identification LED\n");
+ netdev_dbg(hw->adapter->netdev, "Error initializing identification LED\n");
/* This is not fatal and we should not stop init due to this */

/* Disabling VLAN filtering */
- e_dbg("Initializing the IEEE VLAN\n");
+ netdev_dbg(hw->adapter->netdev, "Initializing the IEEE VLAN\n");
mac->ops.clear_vfta(hw);

/* Setup the receive address. */
e1000e_init_rx_addrs(hw, mac->rar_entry_count);

/* Zero out the Multicast HASH table */
- e_dbg("Zeroing the MTA\n");
+ netdev_dbg(hw->adapter->netdev, "Zeroing the MTA\n");
for (i = 0; i < mac->mta_reg_count; i++)
E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0);

@@ -1021,7 +1024,7 @@ static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw)
/* SW Reset the PHY so all changes take effect */
ret_val = e1000e_commit_phy(hw);
if (ret_val) {
- e_dbg("Error Resetting the PHY\n");
+ netdev_dbg(hw->adapter->netdev, "Error Resetting the PHY\n");
return ret_val;
}

diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index b33e3cb..2d7f6d2 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -214,7 +214,7 @@ static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx)
/* Fiber NICs only allow 1000 gbps Full duplex */
if ((adapter->hw.phy.media_type == e1000_media_type_fiber) &&
spddplx != (SPEED_1000 + DUPLEX_FULL)) {
- e_err("Unsupported Speed/Duplex configuration\n");
+ netdev_err(adapter->netdev, "Unsupported Speed/Duplex configuration\n");
return -EINVAL;
}

@@ -237,7 +237,7 @@ static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx)
break;
case SPEED_1000 + DUPLEX_HALF: /* not supported */
default:
- e_err("Unsupported Speed/Duplex configuration\n");
+ netdev_err(adapter->netdev, "Unsupported Speed/Duplex configuration\n");
return -EINVAL;
}
return 0;
@@ -254,8 +254,7 @@ static int e1000_set_settings(struct net_device *netdev,
* cannot be changed
*/
if (e1000_check_reset_block(hw)) {
- e_err("Cannot change link characteristics when SoL/IDER is "
- "active.\n");
+ netdev_err(adapter->netdev, "Cannot change link characteristics when SoL/IDER is active\n");
return -EINVAL;
}

@@ -411,7 +410,7 @@ static int e1000_set_tso(struct net_device *netdev, u32 data)
netdev->features &= ~NETIF_F_TSO6;
}

- e_info("TSO is %s\n", data ? "Enabled" : "Disabled");
+ netdev_info(adapter->netdev, "TSO is %s\n", data ? "Enabled" : "Disabled");
adapter->flags |= FLAG_TSO_FORCE;
return 0;
}
@@ -768,9 +767,9 @@ static bool reg_pattern_test(struct e1000_adapter *adapter, u64 *data,
(test[pat] & write));
val = E1000_READ_REG_ARRAY(&adapter->hw, reg, offset);
if (val != (test[pat] & write & mask)) {
- e_err("pattern test reg %04X failed: got 0x%08X "
- "expected 0x%08X\n", reg + offset, val,
- (test[pat] & write & mask));
+ netdev_err(adapter->netdev, "pattern test reg %04X failed: got 0x%08X expected 0x%08X\n",
+ reg + offset, val,
+ (test[pat] & write & mask));
*data = reg;
return 1;
}
@@ -785,8 +784,8 @@ static bool reg_set_and_check(struct e1000_adapter *adapter, u64 *data,
__ew32(&adapter->hw, reg, write & mask);
val = __er32(&adapter->hw, reg);
if ((write & mask) != (val & mask)) {
- e_err("set/check reg %04X test failed: got 0x%08X "
- "expected 0x%08X\n", reg, (val & mask), (write & mask));
+ netdev_err(adapter->netdev, "set/check reg %04X test failed: got 0x%08X expected 0x%08X\n",
+ reg, (val & mask), (write & mask));
*data = reg;
return 1;
}
@@ -838,8 +837,9 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data)
ew32(STATUS, toggle);
after = er32(STATUS) & toggle;
if (value != after) {
- e_err("failed STATUS register test got: 0x%08X expected: "
- "0x%08X\n", after, value);
+ netdev_err(adapter->netdev,
+ "failed STATUS register test got: 0x%08X expected: 0x%08X\n",
+ after, value);
*data = 1;
return 1;
}
@@ -960,7 +960,8 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
ret_val = -1;
goto out;
}
- e_info("testing %s interrupt\n", (shared_int ? "shared" : "unshared"));
+ netdev_info(adapter->netdev, "testing %s interrupt\n",
+ shared_int ? "shared" : "unshared");

/* Disable all the interrupts */
ew32(IMC, 0xFFFFFFFF);
@@ -1604,7 +1605,7 @@ static int e1000_loopback_test(struct e1000_adapter *adapter, u64 *data)
* sessions are active
*/
if (e1000_check_reset_block(&adapter->hw)) {
- e_err("Cannot do PHY loopback test when SoL/IDER is active.\n");
+ netdev_err(adapter->netdev, "Cannot do PHY loopback test when SoL/IDER is active\n");
*data = 0;
goto out;
}
@@ -1689,7 +1690,7 @@ static void e1000_diag_test(struct net_device *netdev,
forced_speed_duplex = adapter->hw.mac.forced_speed_duplex;
autoneg = adapter->hw.mac.autoneg;

- e_info("offline testing starting\n");
+ netdev_info(adapter->netdev, "offline testing starting\n");

/*
* Link test performed before hardware reset so autoneg doesn't
@@ -1735,7 +1736,7 @@ static void e1000_diag_test(struct net_device *netdev,
if (if_running)
dev_open(netdev);
} else {
- e_info("online testing starting\n");
+ netdev_info(adapter->netdev, "online testing starting\n");
/* Online tests */
if (e1000_link_test(adapter, &data[4]))
eth_test->flags |= ETH_TEST_FL_FAILED;
@@ -1772,8 +1773,8 @@ static void e1000_get_wol(struct net_device *netdev,
wol->supported &= ~WAKE_UCAST;

if (adapter->wol & E1000_WUFC_EX)
- e_err("Interface does not support directed (unicast) "
- "frame wake-up packets\n");
+ netdev_err(adapter->netdev,
+ "Interface does not support directed (unicast) frame wake-up packets\n");
}

if (adapter->wol & E1000_WUFC_EX)
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index 54d03a0..d45a847 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -343,7 +343,8 @@ static s32 e1000_init_phy_params_ich8lan(struct e1000_hw *hw)
phy->ops.read_reg = e1000e_read_phy_reg_bm;
ret_val = e1000e_determine_phy_address(hw);
if (ret_val) {
- e_dbg("Cannot determine PHY addr. Erroring out\n");
+ netdev_dbg(hw->adapter->netdev,
+ "Cannot determine PHY addr. Erroring out\n");
return ret_val;
}
}
@@ -411,7 +412,8 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw)

/* Can't read flash registers if the register set isn't mapped. */
if (!hw->flash_address) {
- e_dbg("ERROR: Flash registers not mapped\n");
+ netdev_dbg(hw->adapter->netdev,
+ "ERROR: Flash registers not mapped\n");
return -E1000_ERR_CONFIG;
}

@@ -595,7 +597,8 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
*/
ret_val = e1000e_config_fc_after_link_up(hw);
if (ret_val)
- e_dbg("Error configuring flow control\n");
+ netdev_dbg(hw->adapter->netdev,
+ "Error configuring flow control\n");

out:
return ret_val;
@@ -687,7 +690,8 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
}

if (!timeout) {
- e_dbg("SW/FW/HW has locked the resource for too long.\n");
+ netdev_dbg(hw->adapter->netdev,
+ "SW/FW/HW has locked the resource for too long\n");
ret_val = -E1000_ERR_CONFIG;
goto out;
}
@@ -707,7 +711,8 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
}

if (!timeout) {
- e_dbg("Failed to acquire the semaphore.\n");
+ netdev_dbg(hw->adapter->netdev,
+ "Failed to acquire the semaphore\n");
extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
ew32(EXTCNF_CTRL, extcnf_ctrl);
ret_val = -E1000_ERR_CONFIG;
@@ -1220,7 +1225,8 @@ static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw)
* leave the PHY in a bad state possibly resulting in no link.
*/
if (loop == 0)
- e_dbg("LAN_INIT_DONE not set, increase timeout\n");
+ netdev_dbg(hw->adapter->netdev,
+ "LAN_INIT_DONE not set, increase timeout\n");

/* Clear the Init Done bit for the next init event */
data = er32(STATUS);
@@ -1506,8 +1512,8 @@ static s32 e1000_valid_nvm_bank_detect_ich8lan(struct e1000_hw *hw, u32 *bank)

return 0;
}
- e_dbg("Unable to determine valid NVM bank via EEC - "
- "reading flash signature\n");
+ netdev_dbg(hw->adapter->netdev,
+ "Unable to determine valid NVM bank via EEC - reading flash signature\n");
/* fall-thru */
default:
/* set bank to 0 in case flash read fails */
@@ -1536,7 +1542,8 @@ static s32 e1000_valid_nvm_bank_detect_ich8lan(struct e1000_hw *hw, u32 *bank)
return 0;
}

- e_dbg("ERROR: No valid NVM bank present\n");
+ netdev_dbg(hw->adapter->netdev,
+ "ERROR: No valid NVM bank present\n");
return -E1000_ERR_NVM;
}

@@ -1564,7 +1571,8 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,

if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) ||
(words == 0)) {
- e_dbg("nvm parameter(s) out of bounds\n");
+ netdev_dbg(hw->adapter->netdev,
+ "nvm parameter(s) out of bounds\n");
ret_val = -E1000_ERR_NVM;
goto out;
}
@@ -1573,7 +1581,8 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,

ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank);
if (ret_val) {
- e_dbg("Could not detect valid bank, assuming bank 0\n");
+ netdev_dbg(hw->adapter->netdev,
+ "Could not detect valid bank, assuming bank 0\n");
bank = 0;
}

@@ -1599,7 +1608,8 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,

out:
if (ret_val)
- e_dbg("NVM read error: %d\n", ret_val);
+ netdev_dbg(hw->adapter->netdev,
+ "NVM read error: %d\n", ret_val);

return ret_val;
}
@@ -1621,8 +1631,8 @@ static s32 e1000_flash_cycle_init_ich8lan(struct e1000_hw *hw)

/* Check if the flash descriptor is valid */
if (hsfsts.hsf_status.fldesvalid == 0) {
- e_dbg("Flash descriptor invalid. "
- "SW Sequencing must be used.");
+ netdev_dbg(hw->adapter->netdev,
+ "Flash descriptor invalid. SW Sequencing must be used\n");
return -E1000_ERR_NVM;
}

@@ -1671,7 +1681,8 @@ static s32 e1000_flash_cycle_init_ich8lan(struct e1000_hw *hw)
hsfsts.hsf_status.flcdone = 1;
ew16flash(ICH_FLASH_HSFSTS, hsfsts.regval);
} else {
- e_dbg("Flash controller busy, cannot get access");
+ netdev_dbg(hw->adapter->netdev,
+ "Flash controller busy, cannot get access\n");
}
}

@@ -1821,8 +1832,8 @@ static s32 e1000_read_flash_data_ich8lan(struct e1000_hw *hw, u32 offset,
/* Repeat for some time before giving up. */
continue;
} else if (hsfsts.hsf_status.flcdone == 0) {
- e_dbg("Timeout error - flash cycle "
- "did not complete.");
+ netdev_dbg(hw->adapter->netdev,
+ "Timeout error - flash cycle did not complete\n");
break;
}
}
@@ -1849,7 +1860,7 @@ static s32 e1000_write_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,

if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) ||
(words == 0)) {
- e_dbg("nvm parameter(s) out of bounds\n");
+ netdev_dbg(hw->adapter->netdev, "nvm parameter(s) out of bounds\n");
return -E1000_ERR_NVM;
}

@@ -1900,7 +1911,8 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
*/
ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank);
if (ret_val) {
- e_dbg("Could not detect valid bank, assuming bank 0\n");
+ netdev_dbg(hw->adapter->netdev,
+ "Could not detect valid bank, assuming bank 0\n");
bank = 0;
}

@@ -1974,7 +1986,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
*/
if (ret_val) {
/* Possibly read-only, see e1000e_write_protect_nvm_ich8lan() */
- e_dbg("Flash commit failed.\n");
+ netdev_dbg(hw->adapter->netdev, "Flash commit failed\n");
nvm->ops.release(hw);
goto out;
}
@@ -2030,7 +2042,8 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)

out:
if (ret_val)
- e_dbg("NVM update error: %d\n", ret_val);
+ netdev_dbg(hw->adapter->netdev,
+ "NVM update error: %d\n", ret_val);

return ret_val;
}
@@ -2180,8 +2193,8 @@ static s32 e1000_write_flash_data_ich8lan(struct e1000_hw *hw, u32 offset,
/* Repeat for some time before giving up. */
continue;
if (hsfsts.hsf_status.flcdone == 0) {
- e_dbg("Timeout error - flash cycle "
- "did not complete.");
+ netdev_dbg(hw->adapter->netdev,
+ "Timeout error - flash cycle did not complete\n");
break;
}
} while (count++ < ICH_FLASH_CYCLE_REPEAT_COUNT);
@@ -2225,7 +2238,8 @@ static s32 e1000_retry_write_flash_byte_ich8lan(struct e1000_hw *hw,
return ret_val;

for (program_retries = 0; program_retries < 100; program_retries++) {
- e_dbg("Retrying Byte %2.2X at offset %u\n", byte, offset);
+ netdev_dbg(hw->adapter->netdev,
+ "Retrying Byte %02X at offset %u\n", byte, offset);
udelay(100);
ret_val = e1000_write_flash_byte_ich8lan(hw, offset, byte);
if (!ret_val)
@@ -2358,7 +2372,7 @@ static s32 e1000_valid_led_default_ich8lan(struct e1000_hw *hw, u16 *data)

ret_val = e1000_read_nvm(hw, NVM_ID_LED_SETTINGS, 1, data);
if (ret_val) {
- e_dbg("NVM Read Error\n");
+ netdev_dbg(hw->adapter->netdev, "NVM Read Error\n");
return ret_val;
}

@@ -2488,10 +2502,11 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
*/
ret_val = e1000e_disable_pcie_master(hw);
if (ret_val) {
- e_dbg("PCI-E Master disable polling has failed.\n");
+ netdev_dbg(hw->adapter->netdev,
+ "PCI-E Master disable polling has failed\n");
}

- e_dbg("Masking off all interrupts\n");
+ netdev_dbg(hw->adapter->netdev, "Masking off all interrupts\n");
ew32(IMC, 0xffffffff);

/*
@@ -2542,7 +2557,7 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
ctrl |= E1000_CTRL_PHY_RST;
}
ret_val = e1000_acquire_swflag_ich8lan(hw);
- e_dbg("Issuing a global reset to ich8lan\n");
+ netdev_dbg(hw->adapter->netdev, "Issuing a global reset to ich8lan\n");
ew32(CTRL, (ctrl | E1000_CTRL_RST));
msleep(20);

@@ -2566,7 +2581,8 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
* return with an error. This can happen in situations
* where there is no eeprom and prevents getting link.
*/
- e_dbg("Auto Read Done did not complete\n");
+ netdev_dbg(hw->adapter->netdev,
+ "Auto Read Done did not complete\n");
}
}
/* Dummy read to clear the phy wakeup bit after lcd reset */
@@ -2625,14 +2641,15 @@ static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw)
/* Initialize identification LED */
ret_val = mac->ops.id_led_init(hw);
if (ret_val)
- e_dbg("Error initializing identification LED\n");
+ netdev_dbg(hw->adapter->netdev,
+ "Error initializing identification LED\n");
/* This is not fatal and we should not stop init due to this */

/* Setup the receive address. */
e1000e_init_rx_addrs(hw, mac->rar_entry_count);

/* Zero out the Multicast HASH table */
- e_dbg("Zeroing the MTA\n");
+ netdev_dbg(hw->adapter->netdev, "Zeroing the MTA\n");
for (i = 0; i < mac->mta_reg_count; i++)
E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0);

@@ -2778,8 +2795,8 @@ static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw)
*/
hw->fc.current_mode = hw->fc.requested_mode;

- e_dbg("After fix-ups FlowControl is now = %x\n",
- hw->fc.current_mode);
+ netdev_dbg(hw->adapter->netdev, "After fix-ups FlowControl is now = %x\n",
+ hw->fc.current_mode);

/* Continue to configure the copper link. */
ret_val = e1000_setup_copper_link_ich8lan(hw);
@@ -2995,7 +3012,7 @@ void e1000e_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw,
struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;

if (hw->mac.type != e1000_ich8lan) {
- e_dbg("Workaround applies to ICH8 only.\n");
+ netdev_dbg(hw->adapter->netdev, "Workaround applies to ICH8 only\n");
return;
}

@@ -3274,7 +3291,8 @@ static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw)
if (status & E1000_STATUS_PHYRA)
ew32(STATUS, status & ~E1000_STATUS_PHYRA);
else
- e_dbg("PHY Reset Asserted not set - needs delay\n");
+ netdev_dbg(hw->adapter->netdev,
+ "PHY Reset Asserted not set - needs delay\n");
}

e1000e_get_cfg_done(hw);
@@ -3289,7 +3307,7 @@ static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw)
} else {
if (e1000_valid_nvm_bank_detect_ich8lan(hw, &bank)) {
/* Maybe we should do a basic PHY config */
- e_dbg("EEPROM not present\n");
+ netdev_dbg(hw->adapter->netdev, "EEPROM not present\n");
return -E1000_ERR_CONFIG;
}
}
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c
index 2425ed1..777d4f0 100644
--- a/drivers/net/e1000e/lib.c
+++ b/drivers/net/e1000e/lib.c
@@ -154,12 +154,12 @@ void e1000e_init_rx_addrs(struct e1000_hw *hw, u16 rar_count)
u8 mac_addr[ETH_ALEN] = {0};

/* Setup the receive address */
- e_dbg("Programming MAC Address into RAR[0]\n");
+ netdev_dbg(hw->adapter->netdev, "Programming MAC Address into RAR[0]\n");

e1000e_rar_set(hw, hw->mac.addr, 0);

/* Zero out the other (rar_entry_count - 1) receive addresses */
- e_dbg("Clearing RAR[1-%u]\n", rar_count-1);
+ netdev_dbg(hw->adapter->netdev, "Clearing RAR[1-%u]\n", rar_count-1);
for (i = 1; i < rar_count; i++)
e1000e_rar_set(hw, mac_addr, i);
}
@@ -186,7 +186,7 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw)
ret_val = e1000_read_nvm(hw, NVM_ALT_MAC_ADDR_PTR, 1,
&nvm_alt_mac_addr_offset);
if (ret_val) {
- e_dbg("NVM Read Error\n");
+ netdev_dbg(hw->adapter->netdev, "NVM Read Error\n");
goto out;
}

@@ -201,7 +201,7 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw)
offset = nvm_alt_mac_addr_offset + (i >> 1);
ret_val = e1000_read_nvm(hw, offset, 1, &nvm_data);
if (ret_val) {
- e_dbg("NVM Read Error\n");
+ netdev_dbg(hw->adapter->netdev, "NVM Read Error\n");
goto out;
}

@@ -211,7 +211,7 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw)

/* if multicast bit is set, the alternate address will not be used */
if (alt_mac_addr[0] & 0x01) {
- e_dbg("Ignoring Alternate Mac Address with MC bit set\n");
+ netdev_dbg(hw->adapter->netdev, "Ignoring Alternate Mac Address with MC bit set\n");
goto out;
}

@@ -484,7 +484,7 @@ s32 e1000e_check_for_copper_link(struct e1000_hw *hw)
*/
ret_val = e1000e_config_fc_after_link_up(hw);
if (ret_val) {
- e_dbg("Error configuring flow control\n");
+ netdev_dbg(hw->adapter->netdev, "Error configuring flow control\n");
}

return ret_val;
@@ -524,7 +524,7 @@ s32 e1000e_check_for_fiber_link(struct e1000_hw *hw)
mac->autoneg_failed = 1;
return 0;
}
- e_dbg("NOT RXing /C/, disable AutoNeg and force link.\n");
+ netdev_dbg(hw->adapter->netdev, "NOT RXing /C/, disable AutoNeg and force link\n");

/* Disable auto-negotiation in the TXCW register */
ew32(TXCW, (mac->txcw & ~E1000_TXCW_ANE));
@@ -537,7 +537,7 @@ s32 e1000e_check_for_fiber_link(struct e1000_hw *hw)
/* Configure Flow Control after forcing link up. */
ret_val = e1000e_config_fc_after_link_up(hw);
if (ret_val) {
- e_dbg("Error configuring flow control\n");
+ netdev_dbg(hw->adapter->netdev, "Error configuring flow control\n");
return ret_val;
}
} else if ((ctrl & E1000_CTRL_SLU) && (rxcw & E1000_RXCW_C)) {
@@ -547,7 +547,7 @@ s32 e1000e_check_for_fiber_link(struct e1000_hw *hw)
* and disable forced link in the Device Control register
* in an attempt to auto-negotiate with our link partner.
*/
- e_dbg("RXing /C/, enable AutoNeg and stop forcing link.\n");
+ netdev_dbg(hw->adapter->netdev, "RXing /C/, enable AutoNeg and stop forcing link\n");
ew32(TXCW, mac->txcw);
ew32(CTRL, (ctrl & ~E1000_CTRL_SLU));

@@ -589,7 +589,7 @@ s32 e1000e_check_for_serdes_link(struct e1000_hw *hw)
mac->autoneg_failed = 1;
return 0;
}
- e_dbg("NOT RXing /C/, disable AutoNeg and force link.\n");
+ netdev_dbg(hw->adapter->netdev, "NOT RXing /C/, disable AutoNeg and force link\n");

/* Disable auto-negotiation in the TXCW register */
ew32(TXCW, (mac->txcw & ~E1000_TXCW_ANE));
@@ -602,7 +602,7 @@ s32 e1000e_check_for_serdes_link(struct e1000_hw *hw)
/* Configure Flow Control after forcing link up. */
ret_val = e1000e_config_fc_after_link_up(hw);
if (ret_val) {
- e_dbg("Error configuring flow control\n");
+ netdev_dbg(hw->adapter->netdev, "Error configuring flow control\n");
return ret_val;
}
} else if ((ctrl & E1000_CTRL_SLU) && (rxcw & E1000_RXCW_C)) {
@@ -612,7 +612,7 @@ s32 e1000e_check_for_serdes_link(struct e1000_hw *hw)
* and disable forced link in the Device Control register
* in an attempt to auto-negotiate with our link partner.
*/
- e_dbg("RXing /C/, enable AutoNeg and stop forcing link.\n");
+ netdev_dbg(hw->adapter->netdev, "RXing /C/, enable AutoNeg and stop forcing link\n");
ew32(TXCW, mac->txcw);
ew32(CTRL, (ctrl & ~E1000_CTRL_SLU));

@@ -629,11 +629,11 @@ s32 e1000e_check_for_serdes_link(struct e1000_hw *hw)
if (rxcw & E1000_RXCW_SYNCH) {
if (!(rxcw & E1000_RXCW_IV)) {
mac->serdes_has_link = true;
- e_dbg("SERDES: Link up - forced.\n");
+ netdev_dbg(hw->adapter->netdev, "SERDES: Link up - forced\n");
}
} else {
mac->serdes_has_link = false;
- e_dbg("SERDES: Link down - force failed.\n");
+ netdev_dbg(hw->adapter->netdev, "SERDES: Link down - force failed\n");
}
}

@@ -646,20 +646,20 @@ s32 e1000e_check_for_serdes_link(struct e1000_hw *hw)
if (rxcw & E1000_RXCW_SYNCH) {
if (!(rxcw & E1000_RXCW_IV)) {
mac->serdes_has_link = true;
- e_dbg("SERDES: Link up - autoneg "
- "completed sucessfully.\n");
+ netdev_dbg(hw->adapter->netdev, "SERDES: Link up - autoneg "
+ "completed sucessfully\n");
} else {
mac->serdes_has_link = false;
- e_dbg("SERDES: Link down - invalid"
- "codewords detected in autoneg.\n");
+ netdev_dbg(hw->adapter->netdev, "SERDES: Link down - invalid"
+ "codewords detected in autoneg\n");
}
} else {
mac->serdes_has_link = false;
- e_dbg("SERDES: Link down - no sync.\n");
+ netdev_dbg(hw->adapter->netdev, "SERDES: Link down - no sync\n");
}
} else {
mac->serdes_has_link = false;
- e_dbg("SERDES: Link down - autoneg failed\n");
+ netdev_dbg(hw->adapter->netdev, "SERDES: Link down - autoneg failed\n");
}
}

@@ -690,7 +690,7 @@ static s32 e1000_set_default_fc_generic(struct e1000_hw *hw)
ret_val = e1000_read_nvm(hw, NVM_INIT_CONTROL2_REG, 1, &nvm_data);

if (ret_val) {
- e_dbg("NVM Read Error\n");
+ netdev_dbg(hw->adapter->netdev, "NVM Read Error\n");
return ret_val;
}

@@ -743,7 +743,7 @@ s32 e1000e_setup_link(struct e1000_hw *hw)
*/
hw->fc.current_mode = hw->fc.requested_mode;

- e_dbg("After fix-ups FlowControl is now = %x\n",
+ netdev_dbg(hw->adapter->netdev, "After fix-ups FlowControl is now = %x\n",
hw->fc.current_mode);

/* Call the necessary media_type subroutine to configure the link. */
@@ -757,7 +757,7 @@ s32 e1000e_setup_link(struct e1000_hw *hw)
* control is disabled, because it does not hurt anything to
* initialize these registers.
*/
- e_dbg("Initializing the Flow Control address, type and timer regs\n");
+ netdev_dbg(hw->adapter->netdev, "Initializing the Flow Control address, type and timer regs\n");
ew32(FCT, FLOW_CONTROL_TYPE);
ew32(FCAH, FLOW_CONTROL_ADDRESS_HIGH);
ew32(FCAL, FLOW_CONTROL_ADDRESS_LOW);
@@ -827,7 +827,7 @@ static s32 e1000_commit_fc_settings_generic(struct e1000_hw *hw)
txcw = (E1000_TXCW_ANE | E1000_TXCW_FD | E1000_TXCW_PAUSE_MASK);
break;
default:
- e_dbg("Flow control param set incorrectly\n");
+ netdev_dbg(hw->adapter->netdev, "Flow control param set incorrectly\n");
return -E1000_ERR_CONFIG;
break;
}
@@ -865,7 +865,7 @@ static s32 e1000_poll_fiber_serdes_link_generic(struct e1000_hw *hw)
break;
}
if (i == FIBER_LINK_UP_LIMIT) {
- e_dbg("Never got a valid link from auto-neg!!!\n");
+ netdev_dbg(hw->adapter->netdev, "Never got a valid link from auto-neg!!!\n");
mac->autoneg_failed = 1;
/*
* AutoNeg failed to achieve a link, so we'll call
@@ -875,13 +875,13 @@ static s32 e1000_poll_fiber_serdes_link_generic(struct e1000_hw *hw)
*/
ret_val = mac->ops.check_for_link(hw);
if (ret_val) {
- e_dbg("Error while checking for link\n");
+ netdev_dbg(hw->adapter->netdev, "Error while checking for link\n");
return ret_val;
}
mac->autoneg_failed = 0;
} else {
mac->autoneg_failed = 0;
- e_dbg("Valid Link Found\n");
+ netdev_dbg(hw->adapter->netdev, "Valid Link Found\n");
}

return 0;
@@ -917,7 +917,7 @@ s32 e1000e_setup_fiber_serdes_link(struct e1000_hw *hw)
* then the link-up status bit will be set and the flow control enable
* bits (RFCE and TFCE) will be set according to their negotiated value.
*/
- e_dbg("Auto-negotiation enabled\n");
+ netdev_dbg(hw->adapter->netdev, "Auto-negotiation enabled\n");

ew32(CTRL, ctrl);
e1e_flush();
@@ -932,7 +932,7 @@ s32 e1000e_setup_fiber_serdes_link(struct e1000_hw *hw)
(er32(CTRL) & E1000_CTRL_SWDPIN1)) {
ret_val = e1000_poll_fiber_serdes_link_generic(hw);
} else {
- e_dbg("No signal detected\n");
+ netdev_dbg(hw->adapter->netdev, "No signal detected\n");
}

return 0;
@@ -1028,7 +1028,7 @@ s32 e1000e_force_mac_fc(struct e1000_hw *hw)
* 3: Both Rx and Tx flow control (symmetric) is enabled.
* other: No other values should be possible at this point.
*/
- e_dbg("hw->fc.current_mode = %u\n", hw->fc.current_mode);
+ netdev_dbg(hw->adapter->netdev, "hw->fc.current_mode = %u\n", hw->fc.current_mode);

switch (hw->fc.current_mode) {
case e1000_fc_none:
@@ -1046,7 +1046,7 @@ s32 e1000e_force_mac_fc(struct e1000_hw *hw)
ctrl |= (E1000_CTRL_TFCE | E1000_CTRL_RFCE);
break;
default:
- e_dbg("Flow control param set incorrectly\n");
+ netdev_dbg(hw->adapter->netdev, "Flow control param set incorrectly\n");
return -E1000_ERR_CONFIG;
}

@@ -1087,7 +1087,7 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw)
}

if (ret_val) {
- e_dbg("Error forcing flow control settings\n");
+ netdev_dbg(hw->adapter->netdev, "Error forcing flow control settings\n");
return ret_val;
}

@@ -1111,8 +1111,8 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw)
return ret_val;

if (!(mii_status_reg & MII_SR_AUTONEG_COMPLETE)) {
- e_dbg("Copper PHY and Auto Neg "
- "has not completed.\n");
+ netdev_dbg(hw->adapter->netdev, "Copper PHY and Auto Neg "
+ "has not completed\n");
return ret_val;
}

@@ -1175,11 +1175,10 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw)
*/
if (hw->fc.requested_mode == e1000_fc_full) {
hw->fc.current_mode = e1000_fc_full;
- e_dbg("Flow Control = FULL.\r\n");
+ netdev_dbg(hw->adapter->netdev, "Flow Control = FULL\n");
} else {
hw->fc.current_mode = e1000_fc_rx_pause;
- e_dbg("Flow Control = "
- "RX PAUSE frames only.\r\n");
+ netdev_dbg(hw->adapter->netdev, "Flow Control = RX PAUSE frames only\n");
}
}
/*
@@ -1195,7 +1194,7 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw)
(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) &&
(mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) {
hw->fc.current_mode = e1000_fc_tx_pause;
- e_dbg("Flow Control = Tx PAUSE frames only.\r\n");
+ netdev_dbg(hw->adapter->netdev, "Flow Control = Tx PAUSE frames only\n");
}
/*
* For transmitting PAUSE frames ONLY.
@@ -1210,14 +1209,14 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw)
!(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) &&
(mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) {
hw->fc.current_mode = e1000_fc_rx_pause;
- e_dbg("Flow Control = Rx PAUSE frames only.\r\n");
+ netdev_dbg(hw->adapter->netdev, "Flow Control = Rx PAUSE frames only\n");
} else {
/*
* Per the IEEE spec, at this point flow control
* should be disabled.
*/
hw->fc.current_mode = e1000_fc_none;
- e_dbg("Flow Control = NONE.\r\n");
+ netdev_dbg(hw->adapter->netdev, "Flow Control = NONE\n");
}

/*
@@ -1227,7 +1226,7 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw)
*/
ret_val = mac->ops.get_link_up_info(hw, &speed, &duplex);
if (ret_val) {
- e_dbg("Error getting link speed and duplex\n");
+ netdev_dbg(hw->adapter->netdev, "Error getting link speed and duplex\n");
return ret_val;
}

@@ -1240,7 +1239,7 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw)
*/
ret_val = e1000e_force_mac_fc(hw);
if (ret_val) {
- e_dbg("Error forcing flow control settings\n");
+ netdev_dbg(hw->adapter->netdev, "Error forcing flow control settings\n");
return ret_val;
}
}
@@ -1264,21 +1263,21 @@ s32 e1000e_get_speed_and_duplex_copper(struct e1000_hw *hw, u16 *speed, u16 *dup
status = er32(STATUS);
if (status & E1000_STATUS_SPEED_1000) {
*speed = SPEED_1000;
- e_dbg("1000 Mbs, ");
+ netdev_dbg(hw->adapter->netdev, "1000 Mbs, ");
} else if (status & E1000_STATUS_SPEED_100) {
*speed = SPEED_100;
- e_dbg("100 Mbs, ");
+ netdev_dbg(hw->adapter->netdev, "100 Mbs, ");
} else {
*speed = SPEED_10;
- e_dbg("10 Mbs, ");
+ netdev_dbg(hw->adapter->netdev, "10 Mbs, ");
}

if (status & E1000_STATUS_FD) {
*duplex = FULL_DUPLEX;
- e_dbg("Full Duplex\n");
+ netdev_dbg(hw->adapter->netdev, "Full Duplex\n");
} else {
*duplex = HALF_DUPLEX;
- e_dbg("Half Duplex\n");
+ netdev_dbg(hw->adapter->netdev, "Half Duplex\n");
}

return 0;
@@ -1324,7 +1323,7 @@ s32 e1000e_get_hw_semaphore(struct e1000_hw *hw)
}

if (i == timeout) {
- e_dbg("Driver can't access device - SMBI bit is set.\n");
+ netdev_dbg(hw->adapter->netdev, "Driver can't access device - SMBI bit is set\n");
return -E1000_ERR_NVM;
}

@@ -1343,7 +1342,7 @@ s32 e1000e_get_hw_semaphore(struct e1000_hw *hw)
if (i == timeout) {
/* Release semaphores */
e1000e_put_hw_semaphore(hw);
- e_dbg("Driver can't access the NVM\n");
+ netdev_dbg(hw->adapter->netdev, "Driver can't access the NVM\n");
return -E1000_ERR_NVM;
}

@@ -1383,7 +1382,7 @@ s32 e1000e_get_auto_rd_done(struct e1000_hw *hw)
}

if (i == AUTO_READ_DONE_TIMEOUT) {
- e_dbg("Auto read by HW from NVM has not completed.\n");
+ netdev_dbg(hw->adapter->netdev, "Auto read by HW from NVM has not completed\n");
return -E1000_ERR_RESET;
}

@@ -1404,7 +1403,7 @@ s32 e1000e_valid_led_default(struct e1000_hw *hw, u16 *data)

ret_val = e1000_read_nvm(hw, NVM_ID_LED_SETTINGS, 1, data);
if (ret_val) {
- e_dbg("NVM Read Error\n");
+ netdev_dbg(hw->adapter->netdev, "NVM Read Error\n");
return ret_val;
}

@@ -1658,7 +1657,7 @@ s32 e1000e_disable_pcie_master(struct e1000_hw *hw)
}

if (!timeout) {
- e_dbg("Master requests are pending.\n");
+ netdev_dbg(hw->adapter->netdev, "Master requests are pending\n");
return -E1000_ERR_MASTER_REQUESTS_PENDING;
}

@@ -1676,7 +1675,7 @@ void e1000e_reset_adaptive(struct e1000_hw *hw)
struct e1000_mac_info *mac = &hw->mac;

if (!mac->adaptive_ifs) {
- e_dbg("Not in Adaptive IFS mode!\n");
+ netdev_dbg(hw->adapter->netdev, "Not in Adaptive IFS mode!\n");
goto out;
}

@@ -1704,7 +1703,7 @@ void e1000e_update_adaptive(struct e1000_hw *hw)
struct e1000_mac_info *mac = &hw->mac;

if (!mac->adaptive_ifs) {
- e_dbg("Not in Adaptive IFS mode!\n");
+ netdev_dbg(hw->adapter->netdev, "Not in Adaptive IFS mode!\n");
goto out;
}

@@ -1896,7 +1895,7 @@ s32 e1000e_acquire_nvm(struct e1000_hw *hw)
if (!timeout) {
eecd &= ~E1000_EECD_REQ;
ew32(EECD, eecd);
- e_dbg("Could not acquire NVM grant\n");
+ netdev_dbg(hw->adapter->netdev, "Could not acquire NVM grant\n");
return -E1000_ERR_NVM;
}

@@ -2001,7 +2000,7 @@ static s32 e1000_ready_nvm_eeprom(struct e1000_hw *hw)
}

if (!timeout) {
- e_dbg("SPI NVM Status error\n");
+ netdev_dbg(hw->adapter->netdev, "SPI NVM Status error\n");
return -E1000_ERR_NVM;
}
}
@@ -2030,7 +2029,7 @@ s32 e1000e_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
*/
if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) ||
(words == 0)) {
- e_dbg("nvm parameter(s) out of bounds\n");
+ netdev_dbg(hw->adapter->netdev, "nvm parameter(s) out of bounds\n");
return -E1000_ERR_NVM;
}

@@ -2073,7 +2072,7 @@ s32 e1000e_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
*/
if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) ||
(words == 0)) {
- e_dbg("nvm parameter(s) out of bounds\n");
+ netdev_dbg(hw->adapter->netdev, "nvm parameter(s) out of bounds\n");
return -E1000_ERR_NVM;
}

@@ -2176,14 +2175,14 @@ s32 e1000e_validate_nvm_checksum_generic(struct e1000_hw *hw)
for (i = 0; i < (NVM_CHECKSUM_REG + 1); i++) {
ret_val = e1000_read_nvm(hw, i, 1, &nvm_data);
if (ret_val) {
- e_dbg("NVM Read Error\n");
+ netdev_dbg(hw->adapter->netdev, "NVM Read Error\n");
return ret_val;
}
checksum += nvm_data;
}

if (checksum != (u16) NVM_SUM) {
- e_dbg("NVM Checksum Invalid\n");
+ netdev_dbg(hw->adapter->netdev, "NVM Checksum Invalid\n");
return -E1000_ERR_NVM;
}

@@ -2207,7 +2206,7 @@ s32 e1000e_update_nvm_checksum_generic(struct e1000_hw *hw)
for (i = 0; i < NVM_CHECKSUM_REG; i++) {
ret_val = e1000_read_nvm(hw, i, 1, &nvm_data);
if (ret_val) {
- e_dbg("NVM Read Error while updating checksum.\n");
+ netdev_dbg(hw->adapter->netdev, "NVM Read Error while updating checksum\n");
return ret_val;
}
checksum += nvm_data;
@@ -2215,7 +2214,7 @@ s32 e1000e_update_nvm_checksum_generic(struct e1000_hw *hw)
checksum = (u16) NVM_SUM - checksum;
ret_val = e1000_write_nvm(hw, NVM_CHECKSUM_REG, 1, &checksum);
if (ret_val)
- e_dbg("NVM Write Error while updating checksum.\n");
+ netdev_dbg(hw->adapter->netdev, "NVM Write Error while updating checksum\n");

return ret_val;
}
@@ -2278,7 +2277,7 @@ static s32 e1000_mng_enable_host_if(struct e1000_hw *hw)
/* Check that the host interface is enabled. */
hicr = er32(HICR);
if ((hicr & E1000_HICR_EN) == 0) {
- e_dbg("E1000_HOST_EN bit disabled.\n");
+ netdev_dbg(hw->adapter->netdev, "E1000_HOST_EN bit disabled\n");
return -E1000_ERR_HOST_INTERFACE_COMMAND;
}
/* check the previous command is completed */
@@ -2290,7 +2289,7 @@ static s32 e1000_mng_enable_host_if(struct e1000_hw *hw)
}

if (i == E1000_MNG_DHCP_COMMAND_TIMEOUT) {
- e_dbg("Previous command timeout failed .\n");
+ netdev_dbg(hw->adapter->netdev, "Previous command timeout failed\n");
return -E1000_ERR_HOST_INTERFACE_COMMAND;
}

@@ -2563,14 +2562,14 @@ s32 e1000e_read_pba_num(struct e1000_hw *hw, u32 *pba_num)

ret_val = e1000_read_nvm(hw, NVM_PBA_OFFSET_0, 1, &nvm_data);
if (ret_val) {
- e_dbg("NVM Read Error\n");
+ netdev_dbg(hw->adapter->netdev, "NVM Read Error\n");
return ret_val;
}
*pba_num = (u32)(nvm_data << 16);

ret_val = e1000_read_nvm(hw, NVM_PBA_OFFSET_1, 1, &nvm_data);
if (ret_val) {
- e_dbg("NVM Read Error\n");
+ netdev_dbg(hw->adapter->netdev, "NVM Read Error\n");
return ret_val;
}
*pba_num |= nvm_data;
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 88d54d3..4de5064 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -26,6 +26,8 @@

*******************************************************************************/

+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include <linux/module.h>
#include <linux/types.h>
#include <linux/init.h>
@@ -404,7 +406,6 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
{
struct net_device *netdev = adapter->netdev;
struct pci_dev *pdev = adapter->pdev;
- struct e1000_hw *hw = &adapter->hw;
struct e1000_ring *rx_ring = adapter->rx_ring;
struct e1000_rx_desc *rx_desc, *next_rxd;
struct e1000_buffer *buffer_info, *next_buffer;
@@ -462,7 +463,7 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,

if (adapter->flags2 & FLAG2_IS_DISCARDING) {
/* All receives must fit into a single buffer */
- e_dbg("Receive packet consumed multiple buffers\n");
+ netdev_dbg(adapter->netdev, "Receive packet consumed multiple buffers\n");
/* recycle */
buffer_info->skb = skb;
if (status & E1000_RXD_STAT_EOP)
@@ -581,7 +582,7 @@ static void e1000_print_hw_hang(struct work_struct *work)
pci_read_config_word(adapter->pdev, PCI_STATUS, &pci_status);

/* detected Hardware unit hang */
- e_err("Detected Hardware Unit Hang:\n"
+ netdev_err(adapter->netdev, "Detected Hardware Unit Hang:\n"
" TDH <%x>\n"
" TDT <%x>\n"
" next_to_use <%x>\n"
@@ -712,7 +713,6 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter)
static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
int *work_done, int work_to_do)
{
- struct e1000_hw *hw = &adapter->hw;
union e1000_rx_desc_packet_split *rx_desc, *next_rxd;
struct net_device *netdev = adapter->netdev;
struct pci_dev *pdev = adapter->pdev;
@@ -760,7 +760,7 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
adapter->flags2 |= FLAG2_IS_DISCARDING;

if (adapter->flags2 & FLAG2_IS_DISCARDING) {
- e_dbg("Packet Split buffers didn't pick up the full "
+ netdev_dbg(adapter->netdev, "Packet Split buffers didn't pick up the full "
"packet\n");
dev_kfree_skb_irq(skb);
if (staterr & E1000_RXD_STAT_EOP)
@@ -776,7 +776,7 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
length = le16_to_cpu(rx_desc->wb.middle.length0);

if (!length) {
- e_dbg("Last part of the packet spanning multiple "
+ netdev_dbg(adapter->netdev, "Last part of the packet spanning multiple "
"descriptors\n");
dev_kfree_skb_irq(skb);
goto next_desc;
@@ -1036,7 +1036,7 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter,

/* eth type trans needs skb->data to point to something */
if (!pskb_may_pull(skb, ETH_HLEN)) {
- e_err("pskb_may_pull failed.\n");
+ netdev_err(adapter->netdev, "pskb_may_pull failed\n");
dev_kfree_skb(skb);
goto next_desc;
}
@@ -1457,8 +1457,8 @@ void e1000e_set_interrupt_capability(struct e1000_adapter *adapter)
return;
}
/* MSI-X failed, so fall through and try MSI */
- e_err("Failed to initialize MSI-X interrupts. "
- "Falling back to MSI interrupts.\n");
+ netdev_err(adapter->netdev, "Failed to initialize MSI-X interrupts. "
+ "Falling back to MSI interrupts\n");
e1000e_reset_interrupt_capability(adapter);
}
adapter->int_mode = E1000E_INT_MODE_MSI;
@@ -1468,8 +1468,8 @@ void e1000e_set_interrupt_capability(struct e1000_adapter *adapter)
adapter->flags |= FLAG_MSI_ENABLED;
} else {
adapter->int_mode = E1000E_INT_MODE_LEGACY;
- e_err("Failed to initialize MSI interrupts. Falling "
- "back to legacy interrupts.\n");
+ netdev_err(adapter->netdev, "Failed to initialize MSI interrupts. Falling "
+ "back to legacy interrupts\n");
}
/* Fall through */
case E1000E_INT_MODE_LEGACY:
@@ -1562,7 +1562,7 @@ static int e1000_request_irq(struct e1000_adapter *adapter)
err = request_irq(adapter->pdev->irq, e1000_intr, IRQF_SHARED,
netdev->name, netdev);
if (err)
- e_err("Unable to allocate interrupt, Error: %d\n", err);
+ netdev_err(adapter->netdev, "Unable to allocate interrupt, Error: %d\n", err);

return err;
}
@@ -1716,7 +1716,7 @@ int e1000e_setup_tx_resources(struct e1000_adapter *adapter)
return 0;
err:
vfree(tx_ring->buffer_info);
- e_err("Unable to allocate memory for the transmit descriptor ring\n");
+ netdev_err(adapter->netdev, "Unable to allocate memory for the transmit descriptor ring\n");
return err;
}

@@ -1770,7 +1770,7 @@ err_pages:
}
err:
vfree(rx_ring->buffer_info);
- e_err("Unable to allocate memory for the transmit descriptor ring\n");
+ netdev_err(adapter->netdev, "Unable to allocate memory for the transmit descriptor ring\n");
return err;
}

@@ -1996,7 +1996,7 @@ static int __devinit e1000_alloc_queues(struct e1000_adapter *adapter)

return 0;
err:
- e_err("Unable to allocate memory for queues\n");
+ netdev_err(adapter->netdev, "Unable to allocate memory for queues\n");
kfree(adapter->rx_ring);
kfree(adapter->tx_ring);
return -ENOMEM;
@@ -2789,7 +2789,7 @@ void e1000e_reset(struct e1000_adapter *adapter)
e1e_wphy(&adapter->hw, BM_WUC, 0);

if (mac->ops.init_hw(hw))
- e_err("Hardware Error\n");
+ netdev_err(adapter->netdev, "Hardware Error\n");

/* additional part of the flow-control workaround above */
if (hw->mac.type == e1000_pchlan)
@@ -2948,7 +2948,7 @@ static irqreturn_t e1000_intr_msi_test(int irq, void *data)
struct e1000_hw *hw = &adapter->hw;
u32 icr = er32(ICR);

- e_dbg("icr is %08X\n", icr);
+ netdev_dbg(adapter->netdev, "icr is %08X\n", icr);
if (icr & E1000_ICR_RXSEQ) {
adapter->flags &= ~FLAG_MSI_TEST_FAILED;
wmb();
@@ -3008,7 +3008,7 @@ static int e1000_test_msi_interrupt(struct e1000_adapter *adapter)
if (adapter->flags & FLAG_MSI_TEST_FAILED) {
adapter->int_mode = E1000E_INT_MODE_LEGACY;
err = -EIO;
- e_info("MSI interrupt test failed!\n");
+ netdev_info(adapter->netdev, "MSI interrupt test failed!\n");
}

free_irq(adapter->pdev->irq, netdev);
@@ -3018,7 +3018,7 @@ static int e1000_test_msi_interrupt(struct e1000_adapter *adapter)
goto msi_test_failed;

/* okay so the test worked, restore settings */
- e_dbg("MSI interrupt test succeeded!\n");
+ netdev_dbg(adapter->netdev, "MSI interrupt test succeeded!\n");
msi_test_failed:
e1000e_set_interrupt_capability(adapter);
e1000_request_irq(adapter);
@@ -3058,7 +3058,7 @@ static int e1000_test_msi(struct e1000_adapter *adapter)
return err;

/* back to INTx mode */
- e_warn("MSI interrupt test failed, using legacy interrupt.\n");
+ netdev_warn(adapter->netdev, "MSI interrupt test failed, using legacy interrupt\n");

e1000_free_irq(adapter);

@@ -3135,7 +3135,7 @@ static int e1000_open(struct net_device *netdev)
if (adapter->int_mode != E1000E_INT_MODE_LEGACY) {
err = e1000_test_msi(adapter);
if (err) {
- e_err("Interrupt allocation failed\n");
+ netdev_err(adapter->netdev, "Interrupt allocation failed\n");
goto err_req_irq;
}
}
@@ -3429,7 +3429,7 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter)
ret_val |= e1e_rphy(hw, PHY_1000T_STATUS, &phy->stat1000);
ret_val |= e1e_rphy(hw, PHY_EXT_STATUS, &phy->estatus);
if (ret_val)
- e_warn("Error reading PHY register\n");
+ netdev_warn(adapter->netdev, "Error reading PHY register\n");
} else {
/*
* Do not read PHY registers if link is not up
@@ -3504,7 +3504,7 @@ bool e1000e_has_link(struct e1000_adapter *adapter)
if ((ret_val == E1000_ERR_PHY) && (hw->phy.type == e1000_phy_igp_3) &&
(er32(CTRL) & E1000_PHY_CTRL_GBE_DISABLE)) {
/* See e1000_kmrn_lock_loss_workaround_ich8lan() */
- e_info("Gigabit has been disabled, downgrading speed\n");
+ netdev_info(adapter->netdev, "Gigabit has been disabled, downgrading speed\n");
}

return link_active;
@@ -3582,10 +3582,10 @@ static void e1000_watchdog_task(struct work_struct *work)
e1e_rphy(hw, PHY_AUTONEG_EXP, &autoneg_exp);

if (!(autoneg_exp & NWAY_ER_LP_NWAY_CAPS))
- e_info("Autonegotiated half duplex but"
+ netdev_info(adapter->netdev, "Autonegotiated half duplex but"
" link partner cannot autoneg. "
" Try forcing full duplex if "
- "link gets many collisions.\n");
+ "link gets many collisions\n");
}

/*
@@ -3627,7 +3627,7 @@ static void e1000_watchdog_task(struct work_struct *work)
switch (adapter->link_speed) {
case SPEED_10:
case SPEED_100:
- e_info("10/100 speed: disabling TSO\n");
+ netdev_info(adapter->netdev, "10/100 speed: disabling TSO\n");
netdev->features &= ~NETIF_F_TSO;
netdev->features &= ~NETIF_F_TSO6;
break;
@@ -3842,7 +3842,7 @@ static bool e1000_tx_csum(struct e1000_adapter *adapter, struct sk_buff *skb)
break;
default:
if (unlikely(net_ratelimit()))
- e_warn("checksum_partial proto=%x!\n",
+ netdev_warn(adapter->netdev, "checksum_partial proto=%x!\n",
be16_to_cpu(protocol));
break;
}
@@ -4157,7 +4157,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,

pull_size = min((unsigned int)4, skb->data_len);
if (!__pskb_pull_tail(skb, pull_size)) {
- e_err("__pskb_pull_tail failed.\n");
+ netdev_err(adapter->netdev, "__pskb_pull_tail failed\n");
dev_kfree_skb_any(skb);
return NETDEV_TX_OK;
}
@@ -4278,14 +4278,14 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
/* Jumbo frame support */
if ((max_frame > ETH_FRAME_LEN + ETH_FCS_LEN) &&
!(adapter->flags & FLAG_HAS_JUMBO_FRAMES)) {
- e_err("Jumbo Frames not supported.\n");
+ netdev_err(adapter->netdev, "Jumbo Frames not supported\n");
return -EINVAL;
}

/* Supported frame sizes */
if ((new_mtu < ETH_ZLEN + ETH_FCS_LEN + VLAN_HLEN) ||
(max_frame > adapter->max_hw_frame_size)) {
- e_err("Unsupported MTU setting\n");
+ netdev_err(adapter->netdev, "Unsupported MTU setting\n");
return -EINVAL;
}

@@ -4293,7 +4293,7 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
msleep(1);
/* e1000e_down -> e1000e_reset dependent on max_frame_size & mtu */
adapter->max_frame_size = max_frame;
- e_info("changing MTU from %d to %d\n", netdev->mtu, new_mtu);
+ netdev_info(adapter->netdev, "changing MTU from %d to %d\n", netdev->mtu, new_mtu);
netdev->mtu = new_mtu;
if (netif_running(netdev))
e1000e_down(adapter);
@@ -4453,20 +4453,20 @@ static int e1000_init_phy_wakeup(struct e1000_adapter *adapter, u32 wufc)
/* activate PHY wakeup */
retval = hw->phy.ops.acquire(hw);
if (retval) {
- e_err("Could not acquire PHY\n");
+ netdev_err(adapter->netdev, "Could not acquire PHY\n");
return retval;
}
e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT,
(BM_WUC_ENABLE_PAGE << IGP_PAGE_SHIFT));
retval = e1000e_read_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, &phy_reg);
if (retval) {
- e_err("Could not read PHY page 769\n");
+ netdev_err(adapter->netdev, "Could not read PHY page 769\n");
goto out;
}
phy_reg |= BM_WUC_ENABLE_BIT | BM_WUC_HOST_WU_BIT;
retval = e1000e_write_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, phy_reg);
if (retval)
- e_err("Could not set PHY Host Wakeup bit\n");
+ netdev_err(adapter->netdev, "Could not set PHY Host Wakeup bit\n");
out:
hw->phy.ops.release(hw);

@@ -4688,7 +4688,7 @@ static int e1000_resume(struct pci_dev *pdev)

e1e_rphy(&adapter->hw, BM_WUS, &phy_data);
if (phy_data) {
- e_info("PHY Wakeup cause - %s\n",
+ netdev_info(adapter->netdev, "PHY Wakeup cause - %s\n",
phy_data & E1000_WUS_EX ? "Unicast Packet" :
phy_data & E1000_WUS_MC ? "Multicast Packet" :
phy_data & E1000_WUS_BC ? "Broadcast Packet" :
@@ -4700,7 +4700,7 @@ static int e1000_resume(struct pci_dev *pdev)
} else {
u32 wus = er32(WUS);
if (wus) {
- e_info("MAC Wakeup cause - %s\n",
+ netdev_info(adapter->netdev, "MAC Wakeup cause - %s\n",
wus & E1000_WUS_EX ? "Unicast Packet" :
wus & E1000_WUS_MC ? "Multicast Packet" :
wus & E1000_WUS_BC ? "Broadcast Packet" :
@@ -4805,7 +4805,7 @@ static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev)
err = pci_enable_device_mem(pdev);
if (err) {
dev_err(&pdev->dev,
- "Cannot re-enable PCI device after reset.\n");
+ "Cannot re-enable PCI device after reset\n");
result = PCI_ERS_RESULT_DISCONNECT;
} else {
pci_set_master(pdev);
@@ -4867,16 +4867,16 @@ static void e1000_print_device_info(struct e1000_adapter *adapter)
u32 pba_num;

/* print bus type/speed/width info */
- e_info("(PCI Express:2.5GB/s:%s) %pM\n",
+ netdev_info(adapter->netdev, "(PCI Express:2.5GB/s:%s) %pM\n",
/* bus width */
((hw->bus.width == e1000_bus_width_pcie_x4) ? "Width x4" :
"Width x1"),
/* MAC address */
netdev->dev_addr);
- e_info("Intel(R) PRO/%s Network Connection\n",
+ netdev_info(adapter->netdev, "Intel(R) PRO/%s Network Connection\n",
(hw->phy.type == e1000_phy_ife) ? "10/100" : "1000");
e1000e_read_pba_num(hw, &pba_num);
- e_info("MAC: %d, PHY: %d, PBA No: %06x-%03x\n",
+ netdev_info(adapter->netdev, "MAC: %d, PHY: %d, PBA No: %06x-%03x\n",
hw->mac.type, hw->phy.type, (pba_num >> 8), (pba_num & 0xff));
}

@@ -5073,7 +5073,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
}

if (e1000_check_reset_block(&adapter->hw))
- e_info("PHY reset is blocked due to SOL/IDER session.\n");
+ netdev_info(adapter->netdev, "PHY reset is blocked due to SOL/IDER session\n");

netdev->features = NETIF_F_SG |
NETIF_F_HW_CSUM |
@@ -5111,7 +5111,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
if (e1000_validate_nvm_checksum(&adapter->hw) >= 0)
break;
if (i == 2) {
- e_err("The NVM Checksum Is Not Valid\n");
+ netdev_err(adapter->netdev, "The NVM Checksum Is Not Valid\n");
err = -EIO;
goto err_eeprom;
}
@@ -5121,13 +5121,13 @@ static int __devinit e1000_probe(struct pci_dev *pdev,

/* copy the MAC address */
if (e1000e_read_mac_addr(&adapter->hw))
- e_err("NVM Read Error while reading MAC address\n");
+ netdev_err(adapter->netdev, "NVM Read Error while reading MAC address\n");

memcpy(netdev->dev_addr, adapter->hw.mac.addr, netdev->addr_len);
memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len);

if (!is_valid_ether_addr(netdev->perm_addr)) {
- e_err("Invalid MAC Address: %pM\n", netdev->perm_addr);
+ netdev_err(adapter->netdev, "Invalid MAC Address: %pM\n", netdev->perm_addr);
err = -EIO;
goto err_eeprom;
}
@@ -5403,10 +5403,9 @@ static struct pci_driver e1000_driver = {
static int __init e1000_init_module(void)
{
int ret;
- printk(KERN_INFO "%s: Intel(R) PRO/1000 Network Driver - %s\n",
- e1000e_driver_name, e1000e_driver_version);
- printk(KERN_INFO "%s: Copyright (c) 1999 - 2009 Intel Corporation.\n",
- e1000e_driver_name);
+ pr_info("Intel(R) PRO/1000 Network Driver - %s\n",
+ e1000e_driver_version);
+ pr_info("Copyright (c) 1999 - 2009 Intel Corporation\n");
ret = pci_register_driver(&e1000_driver);

return ret;
diff --git a/drivers/net/e1000e/param.c b/drivers/net/e1000e/param.c
index 2e39977..a4ee418 100644
--- a/drivers/net/e1000e/param.c
+++ b/drivers/net/e1000e/param.c
@@ -191,16 +191,16 @@ static int __devinit e1000_validate_option(unsigned int *value,
case enable_option:
switch (*value) {
case OPTION_ENABLED:
- e_info("%s Enabled\n", opt->name);
+ netdev_info(adapter->netdev, "%s Enabled\n", opt->name);
return 0;
case OPTION_DISABLED:
- e_info("%s Disabled\n", opt->name);
+ netdev_info(adapter->netdev, "%s Disabled\n", opt->name);
return 0;
}
break;
case range_option:
if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) {
- e_info("%s set to %i\n", opt->name, *value);
+ netdev_info(adapter->netdev, "%s set to %i\n", opt->name, *value);
return 0;
}
break;
@@ -212,7 +212,7 @@ static int __devinit e1000_validate_option(unsigned int *value,
ent = &opt->arg.l.p[i];
if (*value == ent->i) {
if (ent->str[0] != '\0')
- e_info("%s\n", ent->str);
+ netdev_info(adapter->netdev, "%s\n", ent->str);
return 0;
}
}
@@ -222,7 +222,7 @@ static int __devinit e1000_validate_option(unsigned int *value,
BUG();
}

- e_info("Invalid %s value specified (%i) %s\n", opt->name, *value,
+ netdev_info(adapter->netdev, "Invalid %s value specified (%i) %s\n", opt->name, *value,
opt->err);
*value = opt->def;
return -1;
@@ -243,8 +243,8 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
int bd = adapter->bd_number;

if (bd >= E1000_MAX_NIC) {
- e_notice("Warning: no configuration for board #%i\n", bd);
- e_notice("Using defaults for all values\n");
+ netdev_notice(adapter->netdev, "Warning: no configuration for board #%i\n", bd);
+ netdev_notice(adapter->netdev, "Using defaults for all values\n");
}

{ /* Transmit Interrupt Delay */
@@ -338,15 +338,15 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
adapter->itr = InterruptThrottleRate[bd];
switch (adapter->itr) {
case 0:
- e_info("%s turned off\n", opt.name);
+ netdev_info(adapter->netdev, "%s turned off\n", opt.name);
break;
case 1:
- e_info("%s set to dynamic mode\n", opt.name);
+ netdev_info(adapter->netdev, "%s set to dynamic mode\n", opt.name);
adapter->itr_setting = adapter->itr;
adapter->itr = 20000;
break;
case 3:
- e_info("%s set to dynamic conservative mode\n",
+ netdev_info(adapter->netdev, "%s set to dynamic conservative mode\n",
opt.name);
adapter->itr_setting = adapter->itr;
adapter->itr = 20000;
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c
index 7f3ceb9..7f10869 100644
--- a/drivers/net/e1000e/phy.c
+++ b/drivers/net/e1000e/phy.c
@@ -190,7 +190,7 @@ s32 e1000e_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data)
u32 i, mdic = 0;

if (offset > MAX_PHY_REG_ADDRESS) {
- e_dbg("PHY Address %d is out of range\n", offset);
+ netdev_dbg(hw->adapter->netdev, "PHY Address %d is out of range\n", offset);
return -E1000_ERR_PARAM;
}

@@ -217,11 +217,11 @@ s32 e1000e_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data)
break;
}
if (!(mdic & E1000_MDIC_READY)) {
- e_dbg("MDI Read did not complete\n");
+ netdev_dbg(hw->adapter->netdev, "MDI Read did not complete\n");
return -E1000_ERR_PHY;
}
if (mdic & E1000_MDIC_ERROR) {
- e_dbg("MDI Error\n");
+ netdev_dbg(hw->adapter->netdev, "MDI Error\n");
return -E1000_ERR_PHY;
}
*data = (u16) mdic;
@@ -243,7 +243,7 @@ s32 e1000e_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data)
u32 i, mdic = 0;

if (offset > MAX_PHY_REG_ADDRESS) {
- e_dbg("PHY Address %d is out of range\n", offset);
+ netdev_dbg(hw->adapter->netdev, "PHY Address %d is out of range\n", offset);
return -E1000_ERR_PARAM;
}

@@ -271,11 +271,11 @@ s32 e1000e_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data)
break;
}
if (!(mdic & E1000_MDIC_READY)) {
- e_dbg("MDI Write did not complete\n");
+ netdev_dbg(hw->adapter->netdev, "MDI Write did not complete\n");
return -E1000_ERR_PHY;
}
if (mdic & E1000_MDIC_ERROR) {
- e_dbg("MDI Error\n");
+ netdev_dbg(hw->adapter->netdev, "MDI Error\n");
return -E1000_ERR_PHY;
}

@@ -755,7 +755,7 @@ s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw)
/* Commit the changes. */
ret_val = e1000e_commit_phy(hw);
if (ret_val) {
- e_dbg("Error committing the PHY changes\n");
+ netdev_dbg(hw->adapter->netdev, "Error committing the PHY changes\n");
return ret_val;
}

@@ -792,7 +792,7 @@ s32 e1000e_copper_link_setup_igp(struct e1000_hw *hw)

ret_val = e1000_phy_hw_reset(hw);
if (ret_val) {
- e_dbg("Error resetting the PHY.\n");
+ netdev_dbg(hw->adapter->netdev, "Error resetting the PHY\n");
return ret_val;
}

@@ -805,7 +805,7 @@ s32 e1000e_copper_link_setup_igp(struct e1000_hw *hw)
/* disable lplu d0 during driver init */
ret_val = e1000_set_d0_lplu_state(hw, false);
if (ret_val) {
- e_dbg("Error Disabling LPLU D0\n");
+ netdev_dbg(hw->adapter->netdev, "Error Disabling LPLU D0\n");
return ret_val;
}
/* Configure mdi-mdix settings */
@@ -941,39 +941,39 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
NWAY_AR_10T_HD_CAPS);
mii_1000t_ctrl_reg &= ~(CR_1000T_HD_CAPS | CR_1000T_FD_CAPS);

- e_dbg("autoneg_advertised %x\n", phy->autoneg_advertised);
+ netdev_dbg(hw->adapter->netdev, "autoneg_advertised %x\n", phy->autoneg_advertised);

/* Do we want to advertise 10 Mb Half Duplex? */
if (phy->autoneg_advertised & ADVERTISE_10_HALF) {
- e_dbg("Advertise 10mb Half duplex\n");
+ netdev_dbg(hw->adapter->netdev, "Advertise 10mb Half duplex\n");
mii_autoneg_adv_reg |= NWAY_AR_10T_HD_CAPS;
}

/* Do we want to advertise 10 Mb Full Duplex? */
if (phy->autoneg_advertised & ADVERTISE_10_FULL) {
- e_dbg("Advertise 10mb Full duplex\n");
+ netdev_dbg(hw->adapter->netdev, "Advertise 10mb Full duplex\n");
mii_autoneg_adv_reg |= NWAY_AR_10T_FD_CAPS;
}

/* Do we want to advertise 100 Mb Half Duplex? */
if (phy->autoneg_advertised & ADVERTISE_100_HALF) {
- e_dbg("Advertise 100mb Half duplex\n");
+ netdev_dbg(hw->adapter->netdev, "Advertise 100mb Half duplex\n");
mii_autoneg_adv_reg |= NWAY_AR_100TX_HD_CAPS;
}

/* Do we want to advertise 100 Mb Full Duplex? */
if (phy->autoneg_advertised & ADVERTISE_100_FULL) {
- e_dbg("Advertise 100mb Full duplex\n");
+ netdev_dbg(hw->adapter->netdev, "Advertise 100mb Full duplex\n");
mii_autoneg_adv_reg |= NWAY_AR_100TX_FD_CAPS;
}

/* We do not allow the Phy to advertise 1000 Mb Half Duplex */
if (phy->autoneg_advertised & ADVERTISE_1000_HALF)
- e_dbg("Advertise 1000mb Half duplex request denied!\n");
+ netdev_dbg(hw->adapter->netdev, "Advertise 1000mb Half duplex request denied!\n");

/* Do we want to advertise 1000 Mb Full Duplex? */
if (phy->autoneg_advertised & ADVERTISE_1000_FULL) {
- e_dbg("Advertise 1000mb Full duplex\n");
+ netdev_dbg(hw->adapter->netdev, "Advertise 1000mb Full duplex\n");
mii_1000t_ctrl_reg |= CR_1000T_FD_CAPS;
}

@@ -1032,7 +1032,7 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE);
break;
default:
- e_dbg("Flow control param set incorrectly\n");
+ netdev_dbg(hw->adapter->netdev, "Flow control param set incorrectly\n");
ret_val = -E1000_ERR_CONFIG;
return ret_val;
}
@@ -1041,7 +1041,7 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
if (ret_val)
return ret_val;

- e_dbg("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg);
+ netdev_dbg(hw->adapter->netdev, "Auto-Neg Advertising %x\n", mii_autoneg_adv_reg);

if (phy->autoneg_mask & ADVERTISE_1000_FULL) {
ret_val = e1e_wphy(hw, PHY_1000T_CTRL, mii_1000t_ctrl_reg);
@@ -1078,13 +1078,13 @@ static s32 e1000_copper_link_autoneg(struct e1000_hw *hw)
if (phy->autoneg_advertised == 0)
phy->autoneg_advertised = phy->autoneg_mask;

- e_dbg("Reconfiguring auto-neg advertisement params\n");
+ netdev_dbg(hw->adapter->netdev, "Reconfiguring auto-neg advertisement params\n");
ret_val = e1000_phy_setup_autoneg(hw);
if (ret_val) {
- e_dbg("Error Setting up Auto-Negotiation\n");
+ netdev_dbg(hw->adapter->netdev, "Error Setting up Auto-Negotiation\n");
return ret_val;
}
- e_dbg("Restarting Auto-Neg\n");
+ netdev_dbg(hw->adapter->netdev, "Restarting Auto-Neg\n");

/*
* Restart auto-negotiation by setting the Auto Neg Enable bit and
@@ -1106,7 +1106,7 @@ static s32 e1000_copper_link_autoneg(struct e1000_hw *hw)
if (phy->autoneg_wait_to_complete) {
ret_val = e1000_wait_autoneg(hw);
if (ret_val) {
- e_dbg("Error while waiting for "
+ netdev_dbg(hw->adapter->netdev, "Error while waiting for "
"autoneg to complete\n");
return ret_val;
}
@@ -1144,10 +1144,10 @@ s32 e1000e_setup_copper_link(struct e1000_hw *hw)
* PHY will be set to 10H, 10F, 100H or 100F
* depending on user settings.
*/
- e_dbg("Forcing Speed and Duplex\n");
+ netdev_dbg(hw->adapter->netdev, "Forcing Speed and Duplex\n");
ret_val = e1000_phy_force_speed_duplex(hw);
if (ret_val) {
- e_dbg("Error Forcing Speed and Duplex\n");
+ netdev_dbg(hw->adapter->netdev, "Error Forcing Speed and Duplex\n");
return ret_val;
}
}
@@ -1164,11 +1164,11 @@ s32 e1000e_setup_copper_link(struct e1000_hw *hw)
return ret_val;

if (link) {
- e_dbg("Valid link established!!!\n");
+ netdev_dbg(hw->adapter->netdev, "Valid link established!!!\n");
e1000e_config_collision_dist(hw);
ret_val = e1000e_config_fc_after_link_up(hw);
} else {
- e_dbg("Unable to establish link!!!\n");
+ netdev_dbg(hw->adapter->netdev, "Unable to establish link!!!\n");
}

return ret_val;
@@ -1214,12 +1214,12 @@ s32 e1000e_phy_force_speed_duplex_igp(struct e1000_hw *hw)
if (ret_val)
return ret_val;

- e_dbg("IGP PSCR: %X\n", phy_data);
+ netdev_dbg(hw->adapter->netdev, "IGP PSCR: %X\n", phy_data);

udelay(1);

if (phy->autoneg_wait_to_complete) {
- e_dbg("Waiting for forced speed/duplex link on IGP phy.\n");
+ netdev_dbg(hw->adapter->netdev, "Waiting for forced speed/duplex link on IGP phy\n");

ret_val = e1000e_phy_has_link_generic(hw,
PHY_FORCE_LIMIT,
@@ -1229,7 +1229,7 @@ s32 e1000e_phy_force_speed_duplex_igp(struct e1000_hw *hw)
return ret_val;

if (!link)
- e_dbg("Link taking longer than expected.\n");
+ netdev_dbg(hw->adapter->netdev, "Link taking longer than expected\n");

/* Try once more */
ret_val = e1000e_phy_has_link_generic(hw,
@@ -1273,7 +1273,7 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw)
if (ret_val)
return ret_val;

- e_dbg("M88E1000 PSCR: %X\n", phy_data);
+ netdev_dbg(hw->adapter->netdev, "M88E1000 PSCR: %X\n", phy_data);

ret_val = e1e_rphy(hw, PHY_CONTROL, &phy_data);
if (ret_val)
@@ -1291,7 +1291,7 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw)
return ret_val;

if (phy->autoneg_wait_to_complete) {
- e_dbg("Waiting for forced speed/duplex link on M88 phy.\n");
+ netdev_dbg(hw->adapter->netdev, "Waiting for forced speed/duplex link on M88 phy\n");

ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT,
100000, &link);
@@ -1300,7 +1300,7 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw)

if (!link) {
if (hw->phy.type != e1000_phy_m88) {
- e_dbg("Link taking longer than expected.\n");
+ netdev_dbg(hw->adapter->netdev, "Link taking longer than expected\n");
} else {
/*
* We didn't get link.
@@ -1392,12 +1392,12 @@ s32 e1000_phy_force_speed_duplex_ife(struct e1000_hw *hw)
if (ret_val)
goto out;

- e_dbg("IFE PMC: %X\n", data);
+ netdev_dbg(hw->adapter->netdev, "IFE PMC: %X\n", data);

udelay(1);

if (phy->autoneg_wait_to_complete) {
- e_dbg("Waiting for forced speed/duplex link on IFE phy.\n");
+ netdev_dbg(hw->adapter->netdev, "Waiting for forced speed/duplex link on IFE phy\n");

ret_val = e1000e_phy_has_link_generic(hw,
PHY_FORCE_LIMIT,
@@ -1407,7 +1407,7 @@ s32 e1000_phy_force_speed_duplex_ife(struct e1000_hw *hw)
goto out;

if (!link)
- e_dbg("Link taking longer than expected.\n");
+ netdev_dbg(hw->adapter->netdev, "Link taking longer than expected\n");

/* Try once more */
ret_val = e1000e_phy_has_link_generic(hw,
@@ -1457,11 +1457,11 @@ void e1000e_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl)
if (mac->forced_speed_duplex & E1000_ALL_HALF_DUPLEX) {
ctrl &= ~E1000_CTRL_FD;
*phy_ctrl &= ~MII_CR_FULL_DUPLEX;
- e_dbg("Half Duplex\n");
+ netdev_dbg(hw->adapter->netdev, "Half Duplex\n");
} else {
ctrl |= E1000_CTRL_FD;
*phy_ctrl |= MII_CR_FULL_DUPLEX;
- e_dbg("Full Duplex\n");
+ netdev_dbg(hw->adapter->netdev, "Full Duplex\n");
}

/* Forcing 10mb or 100mb? */
@@ -1469,12 +1469,12 @@ void e1000e_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl)
ctrl |= E1000_CTRL_SPD_100;
*phy_ctrl |= MII_CR_SPEED_100;
*phy_ctrl &= ~(MII_CR_SPEED_1000 | MII_CR_SPEED_10);
- e_dbg("Forcing 100mb\n");
+ netdev_dbg(hw->adapter->netdev, "Forcing 100mb\n");
} else {
ctrl &= ~(E1000_CTRL_SPD_1000 | E1000_CTRL_SPD_100);
*phy_ctrl |= MII_CR_SPEED_10;
*phy_ctrl &= ~(MII_CR_SPEED_1000 | MII_CR_SPEED_100);
- e_dbg("Forcing 10mb\n");
+ netdev_dbg(hw->adapter->netdev, "Forcing 10mb\n");
}

e1000e_config_collision_dist(hw);
@@ -1909,7 +1909,7 @@ s32 e1000e_get_phy_info_m88(struct e1000_hw *hw)
bool link;

if (phy->media_type != e1000_media_type_copper) {
- e_dbg("Phy info is only valid for copper media\n");
+ netdev_dbg(hw->adapter->netdev, "Phy info is only valid for copper media\n");
return -E1000_ERR_CONFIG;
}

@@ -1918,7 +1918,7 @@ s32 e1000e_get_phy_info_m88(struct e1000_hw *hw)
return ret_val;

if (!link) {
- e_dbg("Phy info is only valid if link is up\n");
+ netdev_dbg(hw->adapter->netdev, "Phy info is only valid if link is up\n");
return -E1000_ERR_CONFIG;
}

@@ -1986,7 +1986,7 @@ s32 e1000e_get_phy_info_igp(struct e1000_hw *hw)
return ret_val;

if (!link) {
- e_dbg("Phy info is only valid if link is up\n");
+ netdev_dbg(hw->adapter->netdev, "Phy info is only valid if link is up\n");
return -E1000_ERR_CONFIG;
}

@@ -2046,7 +2046,7 @@ s32 e1000_get_phy_info_ife(struct e1000_hw *hw)
goto out;

if (!link) {
- e_dbg("Phy info is only valid if link is up\n");
+ netdev_dbg(hw->adapter->netdev, "Phy info is only valid if link is up\n");
ret_val = -E1000_ERR_CONFIG;
goto out;
}
@@ -2169,7 +2169,7 @@ s32 e1000e_get_cfg_done(struct e1000_hw *hw)
**/
s32 e1000e_phy_init_script_igp3(struct e1000_hw *hw)
{
- e_dbg("Running IGP 3 PHY init script\n");
+ netdev_dbg(hw->adapter->netdev, "Running IGP 3 PHY init script\n");

/* PHY init IGP 3 */
/* Enable rise/fall, 10-mode work in class-A */
@@ -2618,7 +2618,7 @@ static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset,
/* Gig must be disabled for MDIO accesses to page 800 */
if ((hw->mac.type == e1000_pchlan) &&
(!(er32(PHY_CTRL) & E1000_PHY_CTRL_GBE_DISABLE)))
- e_dbg("Attempting to access page 800 while gig enabled.\n");
+ netdev_dbg(hw->adapter->netdev, "Attempting to access page 800 while gig enabled\n");

/* All operations in this function are phy address 1 */
hw->phy.addr = 1;
@@ -2629,7 +2629,7 @@ static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset,

ret_val = e1000e_read_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, &phy_reg);
if (ret_val) {
- e_dbg("Could not read PHY page 769\n");
+ netdev_dbg(hw->adapter->netdev, "Could not read PHY page 769\n");
goto out;
}

@@ -2637,7 +2637,7 @@ static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset,
phy_reg &= ~(BM_WUC_HOST_WU_BIT);
ret_val = e1000e_write_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, phy_reg);
if (ret_val) {
- e_dbg("Could not clear PHY page 769 bit 4\n");
+ netdev_dbg(hw->adapter->netdev, "Could not clear PHY page 769 bit 4\n");
goto out;
}

@@ -2645,7 +2645,7 @@ static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset,
ret_val = e1000e_write_phy_reg_mdic(hw, BM_WUC_ENABLE_REG,
phy_reg | BM_WUC_ENABLE_BIT);
if (ret_val) {
- e_dbg("Could not write PHY page 769 bit 2\n");
+ netdev_dbg(hw->adapter->netdev, "Could not write PHY page 769 bit 2\n");
goto out;
}

@@ -2656,7 +2656,7 @@ static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset,
/* Write the page 800 offset value using opcode 0x11 */
ret_val = e1000e_write_phy_reg_mdic(hw, BM_WUC_ADDRESS_OPCODE, reg);
if (ret_val) {
- e_dbg("Could not write address opcode to page 800\n");
+ netdev_dbg(hw->adapter->netdev, "Could not write address opcode to page 800\n");
goto out;
}

@@ -2671,7 +2671,7 @@ static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset,
}

if (ret_val) {
- e_dbg("Could not access data value from page 800\n");
+ netdev_dbg(hw->adapter->netdev, "Could not access data value from page 800\n");
goto out;
}

@@ -2685,7 +2685,7 @@ static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset,
/* Clear 769_17.2 */
ret_val = e1000e_write_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, phy_reg);
if (ret_val) {
- e_dbg("Could not clear PHY page 769 bit 2\n");
+ netdev_dbg(hw->adapter->netdev, "Could not clear PHY page 769 bit 2\n");
goto out;
}

@@ -3015,7 +3015,7 @@ static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset,
/* masking with 0x3F to remove the page from offset */
ret_val = e1000e_write_phy_reg_mdic(hw, addr_reg, (u16)offset & 0x3F);
if (ret_val) {
- e_dbg("Could not write PHY the HV address register\n");
+ netdev_dbg(hw->adapter->netdev, "Could not write PHY the HV address register\n");
goto out;
}

@@ -3026,7 +3026,7 @@ static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset,
ret_val = e1000e_write_phy_reg_mdic(hw, data_reg, *data);

if (ret_val) {
- e_dbg("Could not read data value from HV data register\n");
+ netdev_dbg(hw->adapter->netdev, "Could not read data value from HV data register\n");
goto out;
}

@@ -3152,12 +3152,12 @@ s32 e1000_phy_force_speed_duplex_82577(struct e1000_hw *hw)
if (ret_val)
goto out;

- e_dbg("I82577_PHY_CTRL_2: %X\n", phy_data);
+ netdev_dbg(hw->adapter->netdev, "I82577_PHY_CTRL_2: %X\n", phy_data);

udelay(1);

if (phy->autoneg_wait_to_complete) {
- e_dbg("Waiting for forced speed/duplex link on 82577 phy\n");
+ netdev_dbg(hw->adapter->netdev, "Waiting for forced speed/duplex link on 82577 phy\n");

ret_val = e1000e_phy_has_link_generic(hw,
PHY_FORCE_LIMIT,
@@ -3167,7 +3167,7 @@ s32 e1000_phy_force_speed_duplex_82577(struct e1000_hw *hw)
goto out;

if (!link)
- e_dbg("Link taking longer than expected.\n");
+ netdev_dbg(hw->adapter->netdev, "Link taking longer than expected\n");

/* Try once more */
ret_val = e1000e_phy_has_link_generic(hw,
@@ -3203,7 +3203,7 @@ s32 e1000_get_phy_info_82577(struct e1000_hw *hw)
goto out;

if (!link) {
- e_dbg("Phy info is only valid if link is up\n");
+ netdev_dbg(hw->adapter->netdev, "Phy info is only valid if link is up\n");
ret_val = -E1000_ERR_CONFIG;
goto out;
}
--
1.7.0.14.g7e948

2010-02-23 02:58:35

by Joe Perches

[permalink] [raw]
Subject: [PATCH net-next 4/7] drivers/net/ixgb: Use pr_<level> and netdev_<level>

Convert DEBUGOUTx to pr_debug
Convert DEBUGFUNC to more commonly used ENTER
Convert mac address output to %pM
Use #define pr_fmt
Convert a few printks to pr_<level>
Improve ixgb_mc_addr_list_update: use a temporary for current mc address
Use etherdevice.h functions for mac address testing

Signed-off-by: Joe Perches <[email protected]>
---
drivers/net/ixgb/ixgb.h | 8 ++-
drivers/net/ixgb/ixgb_ee.c | 14 ++--
drivers/net/ixgb/ixgb_hw.c | 147 +++++++++++++++++------------------------
drivers/net/ixgb/ixgb_hw.h | 12 ----
drivers/net/ixgb/ixgb_main.c | 33 ++++-----
drivers/net/ixgb/ixgb_osdep.h | 16 +----
drivers/net/ixgb/ixgb_param.c | 31 ++++-----
7 files changed, 105 insertions(+), 156 deletions(-)

diff --git a/drivers/net/ixgb/ixgb.h b/drivers/net/ixgb/ixgb.h
index 92d2e71..521c0c7 100644
--- a/drivers/net/ixgb/ixgb.h
+++ b/drivers/net/ixgb/ixgb.h
@@ -78,9 +78,13 @@ struct ixgb_adapter;
#define PFX "ixgb: "

#ifdef _DEBUG_DRIVER_
-#define IXGB_DBG(args...) printk(KERN_DEBUG PFX args)
+#define IXGB_DBG(fmt, args...) printk(KERN_DEBUG PFX fmt, ##args)
#else
-#define IXGB_DBG(args...)
+#define IXGB_DBG(fmt, args...) \
+do { \
+ if (0) \
+ printk(KERN_DEBUG PFX fmt, ##args); \
+} while (0)
#endif

/* TX/RX descriptor defines */
diff --git a/drivers/net/ixgb/ixgb_ee.c b/drivers/net/ixgb/ixgb_ee.c
index 89ffa72..06303a3 100644
--- a/drivers/net/ixgb/ixgb_ee.c
+++ b/drivers/net/ixgb/ixgb_ee.c
@@ -26,6 +26,8 @@

*******************************************************************************/

+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include "ixgb_hw.h"
#include "ixgb_ee.h"
/* Local prototypes */
@@ -467,11 +469,11 @@ ixgb_get_eeprom_data(struct ixgb_hw *hw)
u16 checksum = 0;
struct ixgb_ee_map_type *ee_map;

- DEBUGFUNC("ixgb_get_eeprom_data");
+ ENTER();

ee_map = (struct ixgb_ee_map_type *)hw->eeprom;

- DEBUGOUT("ixgb_ee: Reading eeprom data\n");
+ pr_debug("Reading eeprom data\n");
for (i = 0; i < IXGB_EEPROM_SIZE ; i++) {
u16 ee_data;
ee_data = ixgb_read_eeprom(hw, i);
@@ -480,7 +482,7 @@ ixgb_get_eeprom_data(struct ixgb_hw *hw)
}

if (checksum != (u16) EEPROM_SUM) {
- DEBUGOUT("ixgb_ee: Checksum invalid.\n");
+ pr_debug("Checksum invalid\n");
/* clear the init_ctrl_reg_1 to signify that the cache is
* invalidated */
ee_map->init_ctrl_reg_1 = cpu_to_le16(EEPROM_ICW1_SIGNATURE_CLEAR);
@@ -489,7 +491,7 @@ ixgb_get_eeprom_data(struct ixgb_hw *hw)

if ((ee_map->init_ctrl_reg_1 & cpu_to_le16(EEPROM_ICW1_SIGNATURE_MASK))
!= cpu_to_le16(EEPROM_ICW1_SIGNATURE_VALID)) {
- DEBUGOUT("ixgb_ee: Signature invalid.\n");
+ pr_debug("Signature invalid\n");
return(false);
}

@@ -555,13 +557,13 @@ ixgb_get_ee_mac_addr(struct ixgb_hw *hw,
int i;
struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;

- DEBUGFUNC("ixgb_get_ee_mac_addr");
+ ENTER();

if (ixgb_check_and_get_eeprom_data(hw) == true) {
for (i = 0; i < IXGB_ETH_LENGTH_OF_ADDRESS; i++) {
mac_addr[i] = ee_map->mac_addr[i];
- DEBUGOUT2("mac(%d) = %.2X\n", i, mac_addr[i]);
}
+ pr_debug("eeprom mac address = %pM\n", mac_addr);
}
}

diff --git a/drivers/net/ixgb/ixgb_hw.c b/drivers/net/ixgb/ixgb_hw.c
index ff67a84..cd247b8 100644
--- a/drivers/net/ixgb/ixgb_hw.c
+++ b/drivers/net/ixgb/ixgb_hw.c
@@ -30,9 +30,13 @@
* Shared functions for accessing and configuring the adapter
*/

+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include "ixgb_hw.h"
#include "ixgb_ids.h"

+#include <linux/etherdevice.h>
+
/* Local function prototypes */

static u32 ixgb_hash_mc_addr(struct ixgb_hw *hw, u8 * mc_addr);
@@ -120,13 +124,13 @@ ixgb_adapter_stop(struct ixgb_hw *hw)
u32 ctrl_reg;
u32 icr_reg;

- DEBUGFUNC("ixgb_adapter_stop");
+ ENTER();

/* If we are stopped or resetting exit gracefully and wait to be
* started again before accessing the hardware.
*/
if (hw->adapter_stopped) {
- DEBUGOUT("Exiting because the adapter is already stopped!!!\n");
+ pr_debug("Exiting because the adapter is already stopped!!!\n");
return false;
}

@@ -136,7 +140,7 @@ ixgb_adapter_stop(struct ixgb_hw *hw)
hw->adapter_stopped = true;

/* Clear interrupt mask to stop board from generating interrupts */
- DEBUGOUT("Masking off all interrupts\n");
+ pr_debug("Masking off all interrupts\n");
IXGB_WRITE_REG(hw, IMC, 0xFFFFFFFF);

/* Disable the Transmit and Receive units. Then delay to allow
@@ -152,12 +156,12 @@ ixgb_adapter_stop(struct ixgb_hw *hw)
* the current PCI configuration. The global reset bit is self-
* clearing, and should clear within a microsecond.
*/
- DEBUGOUT("Issuing a global reset to MAC\n");
+ pr_debug("Issuing a global reset to MAC\n");

ctrl_reg = ixgb_mac_reset(hw);

/* Clear interrupt mask to stop board from generating interrupts */
- DEBUGOUT("Masking off all interrupts\n");
+ pr_debug("Masking off all interrupts\n");
IXGB_WRITE_REG(hw, IMC, 0xffffffff);

/* Clear any pending interrupt events. */
@@ -183,7 +187,7 @@ ixgb_identify_xpak_vendor(struct ixgb_hw *hw)
u16 vendor_name[5];
ixgb_xpak_vendor xpak_vendor;

- DEBUGFUNC("ixgb_identify_xpak_vendor");
+ ENTER();

/* Read the first few bytes of the vendor string from the XPAK NVR
* registers. These are standard XENPAK/XPAK registers, so all XPAK
@@ -222,12 +226,12 @@ ixgb_identify_phy(struct ixgb_hw *hw)
ixgb_phy_type phy_type;
ixgb_xpak_vendor xpak_vendor;

- DEBUGFUNC("ixgb_identify_phy");
+ ENTER();

/* Infer the transceiver/phy type from the device id */
switch (hw->device_id) {
case IXGB_DEVICE_ID_82597EX:
- DEBUGOUT("Identified TXN17401 optics\n");
+ pr_debug("Identified TXN17401 optics\n");
phy_type = ixgb_phy_type_txn17401;
break;

@@ -237,30 +241,30 @@ ixgb_identify_phy(struct ixgb_hw *hw)
* type of optics. */
xpak_vendor = ixgb_identify_xpak_vendor(hw);
if (xpak_vendor == ixgb_xpak_vendor_intel) {
- DEBUGOUT("Identified TXN17201 optics\n");
+ pr_debug("Identified TXN17201 optics\n");
phy_type = ixgb_phy_type_txn17201;
} else {
- DEBUGOUT("Identified G6005 optics\n");
+ pr_debug("Identified G6005 optics\n");
phy_type = ixgb_phy_type_g6005;
}
break;
case IXGB_DEVICE_ID_82597EX_LR:
- DEBUGOUT("Identified G6104 optics\n");
+ pr_debug("Identified G6104 optics\n");
phy_type = ixgb_phy_type_g6104;
break;
case IXGB_DEVICE_ID_82597EX_CX4:
- DEBUGOUT("Identified CX4\n");
+ pr_debug("Identified CX4\n");
xpak_vendor = ixgb_identify_xpak_vendor(hw);
if (xpak_vendor == ixgb_xpak_vendor_intel) {
- DEBUGOUT("Identified TXN17201 optics\n");
+ pr_debug("Identified TXN17201 optics\n");
phy_type = ixgb_phy_type_txn17201;
} else {
- DEBUGOUT("Identified G6005 optics\n");
+ pr_debug("Identified G6005 optics\n");
phy_type = ixgb_phy_type_g6005;
}
break;
default:
- DEBUGOUT("Unknown physical layer module\n");
+ pr_debug("Unknown physical layer module\n");
phy_type = ixgb_phy_type_unknown;
break;
}
@@ -296,18 +300,18 @@ ixgb_init_hw(struct ixgb_hw *hw)
u32 ctrl_reg;
bool status;

- DEBUGFUNC("ixgb_init_hw");
+ ENTER();

/* Issue a global reset to the MAC. This will reset the chip's
* transmit, receive, DMA, and link units. It will not effect
* the current PCI configuration. The global reset bit is self-
* clearing, and should clear within a microsecond.
*/
- DEBUGOUT("Issuing a global reset to MAC\n");
+ pr_debug("Issuing a global reset to MAC\n");

ctrl_reg = ixgb_mac_reset(hw);

- DEBUGOUT("Issuing an EE reset to MAC\n");
+ pr_debug("Issuing an EE reset to MAC\n");
#ifdef HP_ZX1
/* Workaround for 82597EX reset errata */
IXGB_WRITE_REG_IO(hw, CTRL1, IXGB_CTRL1_EE_RST);
@@ -335,7 +339,7 @@ ixgb_init_hw(struct ixgb_hw *hw)
* If it is not valid, we fail hardware init.
*/
if (!mac_addr_valid(hw->curr_mac_addr)) {
- DEBUGOUT("MAC address invalid after ixgb_init_rx_addrs\n");
+ pr_debug("MAC address invalid after ixgb_init_rx_addrs\n");
return(false);
}

@@ -346,7 +350,7 @@ ixgb_init_hw(struct ixgb_hw *hw)
ixgb_get_bus_info(hw);

/* Zero out the Multicast HASH table */
- DEBUGOUT("Zeroing the MTA\n");
+ pr_debug("Zeroing the MTA\n");
for (i = 0; i < IXGB_MC_TBL_SIZE; i++)
IXGB_WRITE_REG_ARRAY(hw, MTA, i, 0);

@@ -379,7 +383,7 @@ ixgb_init_rx_addrs(struct ixgb_hw *hw)
{
u32 i;

- DEBUGFUNC("ixgb_init_rx_addrs");
+ ENTER();

/*
* If the current mac address is valid, assume it is a software override
@@ -391,28 +395,19 @@ ixgb_init_rx_addrs(struct ixgb_hw *hw)
/* Get the MAC address from the eeprom for later reference */
ixgb_get_ee_mac_addr(hw, hw->curr_mac_addr);

- DEBUGOUT3(" Keeping Permanent MAC Addr =%.2X %.2X %.2X ",
- hw->curr_mac_addr[0],
- hw->curr_mac_addr[1], hw->curr_mac_addr[2]);
- DEBUGOUT3("%.2X %.2X %.2X\n",
- hw->curr_mac_addr[3],
- hw->curr_mac_addr[4], hw->curr_mac_addr[5]);
+ pr_debug("Keeping Permanent MAC Addr = %pM\n",
+ hw->curr_mac_addr);
} else {

/* Setup the receive address. */
- DEBUGOUT("Overriding MAC Address in RAR[0]\n");
- DEBUGOUT3(" New MAC Addr =%.2X %.2X %.2X ",
- hw->curr_mac_addr[0],
- hw->curr_mac_addr[1], hw->curr_mac_addr[2]);
- DEBUGOUT3("%.2X %.2X %.2X\n",
- hw->curr_mac_addr[3],
- hw->curr_mac_addr[4], hw->curr_mac_addr[5]);
+ pr_debug("Overriding MAC Address in RAR[0]\n");
+ pr_debug("New MAC Addr = %pM\n", hw->curr_mac_addr);

ixgb_rar_set(hw, hw->curr_mac_addr, 0);
}

/* Zero out the other 15 receive addresses. */
- DEBUGOUT("Clearing RAR[1-15]\n");
+ pr_debug("Clearing RAR[1-15]\n");
for (i = 1; i < IXGB_RAR_ENTRIES; i++) {
/* Write high reg first to disable the AV bit first */
IXGB_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0);
@@ -444,64 +439,50 @@ ixgb_mc_addr_list_update(struct ixgb_hw *hw,
u32 hash_value;
u32 i;
u32 rar_used_count = 1; /* RAR[0] is used for our MAC address */
+ u8 *mca;

- DEBUGFUNC("ixgb_mc_addr_list_update");
+ ENTER();

/* Set the new number of MC addresses that we are being requested to use. */
hw->num_mc_addrs = mc_addr_count;

/* Clear RAR[1-15] */
- DEBUGOUT(" Clearing RAR[1-15]\n");
+ pr_debug("Clearing RAR[1-15]\n");
for (i = rar_used_count; i < IXGB_RAR_ENTRIES; i++) {
IXGB_WRITE_REG_ARRAY(hw, RA, (i << 1), 0);
IXGB_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0);
}

/* Clear the MTA */
- DEBUGOUT(" Clearing MTA\n");
+ pr_debug("Clearing MTA\n");
for (i = 0; i < IXGB_MC_TBL_SIZE; i++)
IXGB_WRITE_REG_ARRAY(hw, MTA, i, 0);

/* Add the new addresses */
+ mca = mc_addr_list;
for (i = 0; i < mc_addr_count; i++) {
- DEBUGOUT(" Adding the multicast addresses:\n");
- DEBUGOUT7(" MC Addr #%d =%.2X %.2X %.2X %.2X %.2X %.2X\n", i,
- mc_addr_list[i * (IXGB_ETH_LENGTH_OF_ADDRESS + pad)],
- mc_addr_list[i * (IXGB_ETH_LENGTH_OF_ADDRESS + pad) +
- 1],
- mc_addr_list[i * (IXGB_ETH_LENGTH_OF_ADDRESS + pad) +
- 2],
- mc_addr_list[i * (IXGB_ETH_LENGTH_OF_ADDRESS + pad) +
- 3],
- mc_addr_list[i * (IXGB_ETH_LENGTH_OF_ADDRESS + pad) +
- 4],
- mc_addr_list[i * (IXGB_ETH_LENGTH_OF_ADDRESS + pad) +
- 5]);
+ pr_debug("Adding the multicast addresses:\n");
+ pr_debug("MC Addr #%d = %pM\n", i, mca);

/* Place this multicast address in the RAR if there is room, *
* else put it in the MTA
*/
if (rar_used_count < IXGB_RAR_ENTRIES) {
- ixgb_rar_set(hw,
- mc_addr_list +
- (i * (IXGB_ETH_LENGTH_OF_ADDRESS + pad)),
- rar_used_count);
- DEBUGOUT1("Added a multicast address to RAR[%d]\n", i);
+ ixgb_rar_set(hw, mca, rar_used_count);
+ pr_debug("Added a multicast address to RAR[%d]\n", i);
rar_used_count++;
} else {
- hash_value = ixgb_hash_mc_addr(hw,
- mc_addr_list +
- (i *
- (IXGB_ETH_LENGTH_OF_ADDRESS
- + pad)));
+ hash_value = ixgb_hash_mc_addr(hw, mca);

- DEBUGOUT1(" Hash value = 0x%03X\n", hash_value);
+ pr_debug("Hash value = 0x%03X\n", hash_value);

ixgb_mta_set(hw, hash_value);
}
+
+ mca += IXGB_ETH_LENGTH_OF_ADDRESS + pad;
}

- DEBUGOUT("MC Update Complete\n");
+ pr_debug("MC Update Complete\n");
return;
}

@@ -520,7 +501,7 @@ ixgb_hash_mc_addr(struct ixgb_hw *hw,
{
u32 hash_value = 0;

- DEBUGFUNC("ixgb_hash_mc_addr");
+ ENTER();

/* The portion of the address that is used for the hash table is
* determined by the mc_filter_type setting.
@@ -547,7 +528,7 @@ ixgb_hash_mc_addr(struct ixgb_hw *hw,
break;
default:
/* Invalid mc_filter_type, what should we do? */
- DEBUGOUT("MC filter type param set incorrectly\n");
+ pr_debug("MC filter type param set incorrectly\n");
ASSERT(0);
break;
}
@@ -603,7 +584,7 @@ ixgb_rar_set(struct ixgb_hw *hw,
{
u32 rar_low, rar_high;

- DEBUGFUNC("ixgb_rar_set");
+ ENTER();

/* HW expects these in little endian so we reverse the byte order
* from network order (big endian) to little endian
@@ -666,7 +647,7 @@ ixgb_setup_fc(struct ixgb_hw *hw)
u32 pap_reg = 0; /* by default, assume no pause time */
bool status = true;

- DEBUGFUNC("ixgb_setup_fc");
+ ENTER();

/* Get the current control reg 0 settings */
ctrl_reg = IXGB_READ_REG(hw, CTRL0);
@@ -710,7 +691,7 @@ ixgb_setup_fc(struct ixgb_hw *hw)
break;
default:
/* We should never get here. The value should be 0-3. */
- DEBUGOUT("Flow control param set incorrectly\n");
+ pr_debug("Flow control param set incorrectly\n");
ASSERT(0);
break;
}
@@ -940,7 +921,7 @@ ixgb_check_for_link(struct ixgb_hw *hw)
u32 status_reg;
u32 xpcss_reg;

- DEBUGFUNC("ixgb_check_for_link");
+ ENTER();

xpcss_reg = IXGB_READ_REG(hw, XPCSS);
status_reg = IXGB_READ_REG(hw, STATUS);
@@ -950,7 +931,7 @@ ixgb_check_for_link(struct ixgb_hw *hw)
hw->link_up = true;
} else if (!(xpcss_reg & IXGB_XPCSS_ALIGN_STATUS) &&
(status_reg & IXGB_STATUS_LU)) {
- DEBUGOUT("XPCSS Not Aligned while Status:LU is set.\n");
+ pr_debug("XPCSS Not Aligned while Status:LU is set\n");
hw->link_up = ixgb_link_reset(hw);
} else {
/*
@@ -981,8 +962,7 @@ bool ixgb_check_for_bad_link(struct ixgb_hw *hw)
newRFC = IXGB_READ_REG(hw, RFC);
if ((hw->lastLFC + 250 < newLFC)
|| (hw->lastRFC + 250 < newRFC)) {
- DEBUGOUT
- ("BAD LINK! too many LFC/RFC since last check\n");
+ pr_debug("BAD LINK! too many LFC/RFC since last check\n");
bad_link_returncode = true;
}
hw->lastLFC = newLFC;
@@ -1002,11 +982,11 @@ ixgb_clear_hw_cntrs(struct ixgb_hw *hw)
{
volatile u32 temp_reg;

- DEBUGFUNC("ixgb_clear_hw_cntrs");
+ ENTER();

/* if we are stopped or resetting exit gracefully */
if (hw->adapter_stopped) {
- DEBUGOUT("Exiting because the adapter is stopped!!!\n");
+ pr_debug("Exiting because the adapter is stopped!!!\n");
return;
}

@@ -1156,26 +1136,21 @@ static bool
mac_addr_valid(u8 *mac_addr)
{
bool is_valid = true;
- DEBUGFUNC("mac_addr_valid");
+ ENTER();

/* Make sure it is not a multicast address */
- if (IS_MULTICAST(mac_addr)) {
- DEBUGOUT("MAC address is multicast\n");
+ if (is_multicast_ether_addr(mac_addr)) {
+ pr_debug("MAC address is multicast\n");
is_valid = false;
}
/* Not a broadcast address */
- else if (IS_BROADCAST(mac_addr)) {
- DEBUGOUT("MAC address is broadcast\n");
+ else if (is_broadcast_ether_addr(mac_addr)) {
+ pr_debug("MAC address is broadcast\n");
is_valid = false;
}
/* Reject the zero address */
- else if (mac_addr[0] == 0 &&
- mac_addr[1] == 0 &&
- mac_addr[2] == 0 &&
- mac_addr[3] == 0 &&
- mac_addr[4] == 0 &&
- mac_addr[5] == 0) {
- DEBUGOUT("MAC address is all zeros\n");
+ else if (is_zero_ether_addr(mac_addr)) {
+ pr_debug("MAC address is all zeros\n");
is_valid = false;
}
return (is_valid);
diff --git a/drivers/net/ixgb/ixgb_hw.h b/drivers/net/ixgb/ixgb_hw.h
index af6ca3a..873d32b 100644
--- a/drivers/net/ixgb/ixgb_hw.h
+++ b/drivers/net/ixgb/ixgb_hw.h
@@ -636,18 +636,6 @@ struct ixgb_flash_buffer {
u8 filler3[0xAAAA];
};

-/*
- * This is a little-endian specific check.
- */
-#define IS_MULTICAST(Address) \
- (bool)(((u8 *)(Address))[0] & ((u8)0x01))
-
-/*
- * Check whether an address is broadcast.
- */
-#define IS_BROADCAST(Address) \
- ((((u8 *)(Address))[0] == ((u8)0xff)) && (((u8 *)(Address))[1] == ((u8)0xff)))
-
/* Flow control parameters */
struct ixgb_fc {
u32 high_water; /* Flow Control High-water */
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index 93d0185..cfcc0b2 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -26,6 +26,8 @@

*******************************************************************************/

+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include "ixgb.h"

char ixgb_driver_name[] = "ixgb";
@@ -146,10 +148,8 @@ MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
static int __init
ixgb_init_module(void)
{
- printk(KERN_INFO "%s - version %s\n",
- ixgb_driver_string, ixgb_driver_version);
-
- printk(KERN_INFO "%s\n", ixgb_copyright);
+ pr_info("%s - version %s\n", ixgb_driver_string, ixgb_driver_version);
+ pr_info("%s\n", ixgb_copyright);

return pci_register_driver(&ixgb_driver);
}
@@ -374,8 +374,7 @@ ixgb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
} else {
if ((err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) ||
(err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)))) {
- printk(KERN_ERR
- "ixgb: No usable DMA configuration, aborting\n");
+ pr_err("No usable DMA configuration, aborting\n");
goto err_dma_mask;
}
pci_using_dac = 0;
@@ -1119,15 +1118,14 @@ ixgb_watchdog(unsigned long data)

if (adapter->hw.link_up) {
if (!netif_carrier_ok(netdev)) {
- printk(KERN_INFO "ixgb: %s NIC Link is Up 10 Gbps "
- "Full Duplex, Flow Control: %s\n",
- netdev->name,
- (adapter->hw.fc.type == ixgb_fc_full) ?
- "RX/TX" :
- ((adapter->hw.fc.type == ixgb_fc_rx_pause) ?
- "RX" :
- ((adapter->hw.fc.type == ixgb_fc_tx_pause) ?
- "TX" : "None")));
+ netdev_info(netdev,
+ "NIC Link is Up 10 Gbps Full Duplex, Flow Control: %s\n",
+ (adapter->hw.fc.type == ixgb_fc_full) ?
+ "RX/TX" :
+ (adapter->hw.fc.type == ixgb_fc_rx_pause) ?
+ "RX" :
+ (adapter->hw.fc.type == ixgb_fc_tx_pause) ?
+ "TX" : "None");
adapter->link_speed = 10000;
adapter->link_duplex = FULL_DUPLEX;
netif_carrier_on(netdev);
@@ -1136,8 +1134,7 @@ ixgb_watchdog(unsigned long data)
if (netif_carrier_ok(netdev)) {
adapter->link_speed = 0;
adapter->link_duplex = 0;
- printk(KERN_INFO "ixgb: %s NIC Link is Down\n",
- netdev->name);
+ netdev_info(netdev, "NIC Link is Down\n");
netif_carrier_off(netdev);
}
}
@@ -2323,7 +2320,7 @@ static void ixgb_io_resume(struct pci_dev *pdev)

if (netif_running(netdev)) {
if (ixgb_up(adapter)) {
- printk ("ixgb: can't bring device back up after reset\n");
+ pr_err("can't bring device back up after reset\n");
return;
}
}
diff --git a/drivers/net/ixgb/ixgb_osdep.h b/drivers/net/ixgb/ixgb_osdep.h
index 371a6be..e361185 100644
--- a/drivers/net/ixgb/ixgb_osdep.h
+++ b/drivers/net/ixgb/ixgb_osdep.h
@@ -41,20 +41,8 @@

#undef ASSERT
#define ASSERT(x) BUG_ON(!(x))
-#define MSGOUT(S, A, B) printk(KERN_DEBUG S "\n", A, B)
-
-#ifdef DBG
-#define DEBUGOUT(S) printk(KERN_DEBUG S "\n")
-#define DEBUGOUT1(S, A...) printk(KERN_DEBUG S "\n", A)
-#else
-#define DEBUGOUT(S)
-#define DEBUGOUT1(S, A...)
-#endif
-
-#define DEBUGFUNC(F) DEBUGOUT(F)
-#define DEBUGOUT2 DEBUGOUT1
-#define DEBUGOUT3 DEBUGOUT2
-#define DEBUGOUT7 DEBUGOUT3
+
+#define ENTER() pr_debug("%s\n", __func__);

#define IXGB_WRITE_REG(a, reg, value) ( \
writel((value), ((a)->hw_addr + IXGB_##reg)))
diff --git a/drivers/net/ixgb/ixgb_param.c b/drivers/net/ixgb/ixgb_param.c
index af35e1d..88a08f0 100644
--- a/drivers/net/ixgb/ixgb_param.c
+++ b/drivers/net/ixgb/ixgb_param.c
@@ -26,6 +26,8 @@

*******************************************************************************/

+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include "ixgb.h"

/* This is the only thing that needs to be changed to adjust the
@@ -209,16 +211,16 @@ ixgb_validate_option(unsigned int *value, const struct ixgb_option *opt)
case enable_option:
switch (*value) {
case OPTION_ENABLED:
- printk(KERN_INFO "%s Enabled\n", opt->name);
+ pr_info("%s Enabled\n", opt->name);
return 0;
case OPTION_DISABLED:
- printk(KERN_INFO "%s Disabled\n", opt->name);
+ pr_info("%s Disabled\n", opt->name);
return 0;
}
break;
case range_option:
if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) {
- printk(KERN_INFO "%s set to %i\n", opt->name, *value);
+ pr_info("%s set to %i\n", opt->name, *value);
return 0;
}
break;
@@ -230,7 +232,7 @@ ixgb_validate_option(unsigned int *value, const struct ixgb_option *opt)
ent = &opt->arg.l.p[i];
if (*value == ent->i) {
if (ent->str[0] != '\0')
- printk(KERN_INFO "%s\n", ent->str);
+ pr_info("%s\n", ent->str);
return 0;
}
}
@@ -240,8 +242,7 @@ ixgb_validate_option(unsigned int *value, const struct ixgb_option *opt)
BUG();
}

- printk(KERN_INFO "Invalid %s specified (%i) %s\n",
- opt->name, *value, opt->err);
+ pr_info("Invalid %s specified (%i) %s\n", opt->name, *value, opt->err);
*value = opt->def;
return -1;
}
@@ -261,9 +262,8 @@ ixgb_check_options(struct ixgb_adapter *adapter)
{
int bd = adapter->bd_number;
if (bd >= IXGB_MAX_NIC) {
- printk(KERN_NOTICE
- "Warning: no configuration for board #%i\n", bd);
- printk(KERN_NOTICE "Using defaults for all values\n");
+ pr_notice("Warning: no configuration for board #%i\n", bd);
+ pr_notice("Using defaults for all values\n");
}

{ /* Transmit Descriptor Count */
@@ -363,8 +363,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
adapter->hw.fc.high_water = opt.def;
}
if (!(adapter->hw.fc.type & ixgb_fc_tx_pause) )
- printk(KERN_INFO
- "Ignoring RxFCHighThresh when no RxFC\n");
+ pr_info("Ignoring RxFCHighThresh when no RxFC\n");
}
{ /* Receive Flow Control Low Threshold */
const struct ixgb_option opt = {
@@ -383,8 +382,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
adapter->hw.fc.low_water = opt.def;
}
if (!(adapter->hw.fc.type & ixgb_fc_tx_pause) )
- printk(KERN_INFO
- "Ignoring RxFCLowThresh when no RxFC\n");
+ pr_info("Ignoring RxFCLowThresh when no RxFC\n");
}
{ /* Flow Control Pause Time Request*/
const struct ixgb_option opt = {
@@ -404,17 +402,14 @@ ixgb_check_options(struct ixgb_adapter *adapter)
adapter->hw.fc.pause_time = opt.def;
}
if (!(adapter->hw.fc.type & ixgb_fc_tx_pause) )
- printk(KERN_INFO
- "Ignoring FCReqTimeout when no RxFC\n");
+ pr_info("Ignoring FCReqTimeout when no RxFC\n");
}
/* high low and spacing check for rx flow control thresholds */
if (adapter->hw.fc.type & ixgb_fc_tx_pause) {
/* high must be greater than low */
if (adapter->hw.fc.high_water < (adapter->hw.fc.low_water + 8)) {
/* set defaults */
- printk(KERN_INFO
- "RxFCHighThresh must be >= (RxFCLowThresh + 8), "
- "Using Defaults\n");
+ pr_info("RxFCHighThresh must be >= (RxFCLowThresh + 8), Using Defaults\n");
adapter->hw.fc.high_water = DEFAULT_FCRTH;
adapter->hw.fc.low_water = DEFAULT_FCRTL;
}
--
1.7.0.14.g7e948

2010-02-23 02:58:55

by Joe Perches

[permalink] [raw]
Subject: [PATCH net-next 3/7] drivers/net/ixgbe: Use pr_<level> and netif_<level>

Convert DPRINTK, commonly used for debugging, to netif_<level>
Remove #define PFX
Use #define pr_fmt
Convert a few printks to pr_<level>

Signed-off-by: Joe Perches <[email protected]>
---
drivers/net/ixgbe/ixgbe.h | 6 --
drivers/net/ixgbe/ixgbe_common.h | 15 ++++-
drivers/net/ixgbe/ixgbe_dcb_nl.c | 5 +-
drivers/net/ixgbe/ixgbe_ethtool.c | 40 ++++++++------
drivers/net/ixgbe/ixgbe_fcoe.c | 25 ++++----
drivers/net/ixgbe/ixgbe_main.c | 110 ++++++++++++++++---------------------
drivers/net/ixgbe/ixgbe_phy.c | 2 +
drivers/net/ixgbe/ixgbe_sriov.c | 11 ++--
8 files changed, 106 insertions(+), 108 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe.h b/drivers/net/ixgbe/ixgbe.h
index 19e94ee..3c25bf0 100644
--- a/drivers/net/ixgbe/ixgbe.h
+++ b/drivers/net/ixgbe/ixgbe.h
@@ -44,12 +44,6 @@
#include <linux/dca.h>
#endif

-#define PFX "ixgbe: "
-#define DPRINTK(nlevel, klevel, fmt, args...) \
- ((void)((NETIF_MSG_##nlevel & adapter->msg_enable) && \
- printk(KERN_##klevel PFX "%s: %s: " fmt, adapter->netdev->name, \
- __func__ , ## args)))
-
/* TX/RX descriptor defines */
#define IXGBE_DEFAULT_TXD 512
#define IXGBE_MAX_TXD 4096
diff --git a/drivers/net/ixgbe/ixgbe_common.h b/drivers/net/ixgbe/ixgbe_common.h
index 13606d4..f3e5672 100644
--- a/drivers/net/ixgbe/ixgbe_common.h
+++ b/drivers/net/ixgbe/ixgbe_common.h
@@ -98,11 +98,18 @@ s32 ixgbe_blink_led_stop_generic(struct ixgbe_hw *hw, u32 index);
#define IXGBE_WRITE_FLUSH(a) IXGBE_READ_REG(a, IXGBE_STATUS)

#ifdef DEBUG
-extern char *ixgbe_get_hw_dev_name(struct ixgbe_hw *hw);
-#define hw_dbg(hw, format, arg...) \
- printk(KERN_DEBUG "%s: " format, ixgbe_get_hw_dev_name(hw), ##arg)
+#define hw_dbg(_hw, format, arg...) \
+ netdev_printk(KERN_DEBUG, \
+ ((struct ixgbe_adapter *)(((_hw)->back))->netdev, \
+ format, ##arg)
#else
-#define hw_dbg(hw, format, arg...) do {} while (0)
+#define hw_dbg(_hw, format, arg...) \
+do { \
+ if (0) \
+ netdev_printk(KERN_DEBUG, \
+ ((struct ixgbe_adapter *)((_hw)->back))->netdev, \
+ format, ##arg); \
+} while (0)
#endif

#endif /* IXGBE_COMMON */
diff --git a/drivers/net/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ixgbe/ixgbe_dcb_nl.c
index dd4883f..b233d7e 100644
--- a/drivers/net/ixgbe/ixgbe_dcb_nl.c
+++ b/drivers/net/ixgbe/ixgbe_dcb_nl.c
@@ -26,6 +26,8 @@

*******************************************************************************/

+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include "ixgbe.h"
#include <linux/dcbnl.h>
#include "ixgbe_dcb_82598.h"
@@ -121,7 +123,8 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state)
goto out;

if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED)) {
- DPRINTK(DRV, ERR, "Enable failed, needs MSI-X\n");
+ netif_err(adapter, drv, adapter->netdev,
+ "Enable failed, needs MSI-X\n");
err = 1;
goto out;
}
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c
index 0d23434..2264665 100644
--- a/drivers/net/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ixgbe/ixgbe_ethtool.c
@@ -25,6 +25,8 @@

*******************************************************************************/

+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
/* ethtool support for ixgbe */

#include <linux/types.h>
@@ -293,8 +295,8 @@ static int ixgbe_set_settings(struct net_device *netdev,
hw->mac.autotry_restart = true;
err = hw->mac.ops.setup_link(hw, advertised, true, true);
if (err) {
- DPRINTK(PROBE, INFO,
- "setup link failed with code %d\n", err);
+ netif_info(adapter, probe, adapter->netdev,
+ "setup link failed with code %d\n", err);
hw->mac.ops.setup_link(hw, old, true, true);
}
} else {
@@ -1189,8 +1191,9 @@ static struct ixgbe_reg_test reg_test_82598[] = {
writel((_test[pat] & W), (adapter->hw.hw_addr + R)); \
val = readl(adapter->hw.hw_addr + R); \
if (val != (_test[pat] & W & M)) { \
- DPRINTK(DRV, ERR, "pattern test reg %04X failed: got "\
- "0x%08X expected 0x%08X\n", \
+ netif_err(adapter, drv, adapter->netdev, \
+ "pattern test reg %04X failed: got " \
+ "0x%08X expected 0x%08X\n", \
R, val, (_test[pat] & W & M)); \
*data = R; \
writel(before, adapter->hw.hw_addr + R); \
@@ -1207,8 +1210,9 @@ static struct ixgbe_reg_test reg_test_82598[] = {
writel((W & M), (adapter->hw.hw_addr + R)); \
val = readl(adapter->hw.hw_addr + R); \
if ((W & M) != (val & M)) { \
- DPRINTK(DRV, ERR, "set/check reg %04X test failed: got 0x%08X "\
- "expected 0x%08X\n", R, (val & M), (W & M)); \
+ netif_err(adapter, drv, adapter->netdev, \
+ "set/check reg %04X test failed: got 0x%08X " \
+ "expected 0x%08X\n", R, (val & M), (W & M)); \
*data = R; \
writel(before, (adapter->hw.hw_addr + R)); \
return 1; \
@@ -1241,8 +1245,9 @@ static int ixgbe_reg_test(struct ixgbe_adapter *adapter, u64 *data)
IXGBE_WRITE_REG(&adapter->hw, IXGBE_STATUS, toggle);
after = IXGBE_READ_REG(&adapter->hw, IXGBE_STATUS) & toggle;
if (value != after) {
- DPRINTK(DRV, ERR, "failed STATUS register test got: "
- "0x%08X expected: 0x%08X\n", after, value);
+ netif_err(adapter, drv, adapter->netdev,
+ "failed STATUS register test got: "
+ "0x%08X expected: 0x%08X\n", after, value);
*data = 1;
return 1;
}
@@ -1342,8 +1347,9 @@ static int ixgbe_intr_test(struct ixgbe_adapter *adapter, u64 *data)
*data = 1;
return -1;
}
- DPRINTK(HW, INFO, "testing %s interrupt\n",
- (shared_int ? "shared" : "unshared"));
+ netif_info(adapter, hw, adapter->netdev,
+ "testing %s interrupt\n",
+ shared_int ? "shared" : "unshared");

/* Disable all the interrupts */
IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, 0xFFFFFFFF);
@@ -1848,7 +1854,7 @@ static void ixgbe_diag_test(struct net_device *netdev,
if (eth_test->flags == ETH_TEST_FL_OFFLINE) {
/* Offline tests */

- DPRINTK(HW, INFO, "offline testing starting\n");
+ netif_info(adapter, hw, adapter->netdev, "offline testing starting\n");

/* Link test performed before hardware reset so autoneg doesn't
* interfere with test result */
@@ -1861,17 +1867,17 @@ static void ixgbe_diag_test(struct net_device *netdev,
else
ixgbe_reset(adapter);

- DPRINTK(HW, INFO, "register testing starting\n");
+ netif_info(adapter, hw, adapter->netdev, "register testing starting\n");
if (ixgbe_reg_test(adapter, &data[0]))
eth_test->flags |= ETH_TEST_FL_FAILED;

ixgbe_reset(adapter);
- DPRINTK(HW, INFO, "eeprom testing starting\n");
+ netif_info(adapter, hw, adapter->netdev, "eeprom testing starting\n");
if (ixgbe_eeprom_test(adapter, &data[1]))
eth_test->flags |= ETH_TEST_FL_FAILED;

ixgbe_reset(adapter);
- DPRINTK(HW, INFO, "interrupt testing starting\n");
+ netif_info(adapter, hw, adapter->netdev, "interrupt testing starting\n");
if (ixgbe_intr_test(adapter, &data[2]))
eth_test->flags |= ETH_TEST_FL_FAILED;

@@ -1879,14 +1885,14 @@ static void ixgbe_diag_test(struct net_device *netdev,
* loopback diagnostic. */
if (adapter->flags & (IXGBE_FLAG_SRIOV_ENABLED |
IXGBE_FLAG_VMDQ_ENABLED)) {
- DPRINTK(HW, INFO, "Skip MAC loopback diagnostic in VT "
+ netif_info(adapter, hw, adapter->netdev, "Skip MAC loopback diagnostic in VT "
"mode\n");
data[3] = 0;
goto skip_loopback;
}

ixgbe_reset(adapter);
- DPRINTK(HW, INFO, "loopback testing starting\n");
+ netif_info(adapter, hw, adapter->netdev, "loopback testing starting\n");
if (ixgbe_loopback_test(adapter, &data[3]))
eth_test->flags |= ETH_TEST_FL_FAILED;

@@ -1897,7 +1903,7 @@ skip_loopback:
if (if_running)
dev_open(netdev);
} else {
- DPRINTK(HW, INFO, "online testing starting\n");
+ netif_info(adapter, hw, adapter->netdev, "online testing starting\n");
/* Online tests */
if (ixgbe_link_test(adapter, &data[4]))
eth_test->flags |= ETH_TEST_FL_FAILED;
diff --git a/drivers/net/ixgbe/ixgbe_fcoe.c b/drivers/net/ixgbe/ixgbe_fcoe.c
index 4123dec..16c1b92 100644
--- a/drivers/net/ixgbe/ixgbe_fcoe.c
+++ b/drivers/net/ixgbe/ixgbe_fcoe.c
@@ -25,6 +25,7 @@

*******************************************************************************/

+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include "ixgbe.h"
#ifdef CONFIG_IXGBE_DCB
@@ -163,19 +164,19 @@ int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid,

adapter = netdev_priv(netdev);
if (xid >= IXGBE_FCOE_DDP_MAX) {
- DPRINTK(DRV, WARNING, "xid=0x%x out-of-range\n", xid);
+ netif_warn(adapter, drv, adapter->netdev, "xid=0x%x out-of-range\n", xid);
return 0;
}

fcoe = &adapter->fcoe;
if (!fcoe->pool) {
- DPRINTK(DRV, WARNING, "xid=0x%x no ddp pool for fcoe\n", xid);
+ netif_warn(adapter, drv, adapter->netdev, "xid=0x%x no ddp pool for fcoe\n", xid);
return 0;
}

ddp = &fcoe->ddp[xid];
if (ddp->sgl) {
- DPRINTK(DRV, ERR, "xid 0x%x w/ non-null sgl=%p nents=%d\n",
+ netif_err(adapter, drv, adapter->netdev, "xid 0x%x w/ non-null sgl=%p nents=%d\n",
xid, ddp->sgl, ddp->sgc);
return 0;
}
@@ -184,14 +185,14 @@ int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid,
/* setup dma from scsi command sgl */
dmacount = pci_map_sg(adapter->pdev, sgl, sgc, DMA_FROM_DEVICE);
if (dmacount == 0) {
- DPRINTK(DRV, ERR, "xid 0x%x DMA map error\n", xid);
+ netif_err(adapter, drv, adapter->netdev, "xid 0x%x DMA map error\n", xid);
return 0;
}

/* alloc the udl from our ddp pool */
ddp->udl = pci_pool_alloc(fcoe->pool, GFP_KERNEL, &ddp->udp);
if (!ddp->udl) {
- DPRINTK(DRV, ERR, "failed allocated ddp context\n");
+ netif_err(adapter, drv, adapter->netdev, "failed allocated ddp context\n");
goto out_noddp_unmap;
}
ddp->sgl = sgl;
@@ -229,7 +230,7 @@ int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid,
j++;
/* max number of buffers allowed in one DDP context */
if (j > IXGBE_BUFFCNT_MAX) {
- DPRINTK(DRV, ERR, "xid=%x:%d,%d,%d:addr=%llx "
+ netif_err(adapter, drv, adapter->netdev, "xid=%x:%d,%d,%d:addr=%llx "
"not enough descriptors\n",
xid, i, j, dmacount, (u64)addr);
goto out_noddp_free;
@@ -381,7 +382,7 @@ int ixgbe_fso(struct ixgbe_adapter *adapter,
struct fc_frame_header *fh;

if (skb_is_gso(skb) && (skb_shinfo(skb)->gso_type != SKB_GSO_FCOE)) {
- DPRINTK(DRV, ERR, "Wrong gso type %d:expecting SKB_GSO_FCOE\n",
+ netif_err(adapter, drv, adapter->netdev, "Wrong gso type %d:expecting SKB_GSO_FCOE\n",
skb_shinfo(skb)->gso_type);
return -EINVAL;
}
@@ -408,7 +409,7 @@ int ixgbe_fso(struct ixgbe_adapter *adapter,
fcoe_sof_eof |= IXGBE_ADVTXD_FCOEF_SOF;
break;
default:
- DPRINTK(DRV, WARNING, "unknown sof = 0x%x\n", sof);
+ netif_warn(adapter, drv, adapter->netdev, "unknown sof = 0x%x\n", sof);
return -EINVAL;
}

@@ -435,7 +436,7 @@ int ixgbe_fso(struct ixgbe_adapter *adapter,
fcoe_sof_eof |= IXGBE_ADVTXD_FCOEF_EOF_A;
break;
default:
- DPRINTK(DRV, WARNING, "unknown eof = 0x%x\n", eof);
+ netif_warn(adapter, drv, adapter->netdev, "unknown eof = 0x%x\n", eof);
return -EINVAL;
}

@@ -511,7 +512,7 @@ void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter)
adapter->pdev, IXGBE_FCPTR_MAX,
IXGBE_FCPTR_ALIGN, PAGE_SIZE);
if (!fcoe->pool)
- DPRINTK(DRV, ERR,
+ netif_err(adapter, drv, adapter->netdev,
"failed to allocated FCoE DDP pool\n");

spin_lock_init(&fcoe->lock);
@@ -599,7 +600,7 @@ int ixgbe_fcoe_enable(struct net_device *netdev)
if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED)
goto out_enable;

- DPRINTK(DRV, INFO, "Enabling FCoE offload features.\n");
+ netif_info(adapter, drv, adapter->netdev, "Enabling FCoE offload features.\n");
if (netif_running(netdev))
netdev->netdev_ops->ndo_stop(netdev);

@@ -645,7 +646,7 @@ int ixgbe_fcoe_disable(struct net_device *netdev)
if (!(adapter->flags & IXGBE_FLAG_FCOE_ENABLED))
goto out_disable;

- DPRINTK(DRV, INFO, "Disabling FCoE offload features.\n");
+ netif_info(adapter, drv, adapter->netdev, "Disabling FCoE offload features.\n");
if (netif_running(netdev))
netdev->netdev_ops->ndo_stop(netdev);

diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 43a8de3..5b80771 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -25,6 +25,8 @@

*******************************************************************************/

+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include <linux/types.h>
#include <linux/module.h>
#include <linux/pci.h>
@@ -354,7 +356,7 @@ static inline bool ixgbe_check_tx_hang(struct ixgbe_adapter *adapter,
/* detected Tx unit hang */
union ixgbe_adv_tx_desc *tx_desc;
tx_desc = IXGBE_TX_DESC_ADV(*tx_ring, eop);
- DPRINTK(DRV, ERR, "Detected Tx Unit Hang\n"
+ netif_err(adapter, drv, adapter->netdev, "Detected Tx Unit Hang\n"
" Tx Queue <%d>\n"
" TDH, TDT <%x>, <%x>\n"
" next_to_use <%x>\n"
@@ -470,7 +472,7 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector,
if (adapter->detect_tx_hung) {
if (ixgbe_check_tx_hang(adapter, tx_ring, i)) {
/* schedule immediate reset if we believe we hung */
- DPRINTK(PROBE, INFO,
+ netif_info(adapter, probe, adapter->netdev,
"tx hang %d detected, resetting adapter\n",
adapter->tx_timeout_count + 1);
ixgbe_tx_timeout(adapter->netdev);
@@ -1245,7 +1247,7 @@ static void ixgbe_check_fan_failure(struct ixgbe_adapter *adapter, u32 eicr)

if ((adapter->flags & IXGBE_FLAG_FAN_FAIL_CAPABLE) &&
(eicr & IXGBE_EICR_GPI_SDP1)) {
- DPRINTK(PROBE, CRIT, "Fan has stopped, replace the adapter\n");
+ netif_crit(adapter, probe, adapter->netdev, "Fan has stopped, replace the adapter\n");
/* write to clear the interrupt */
IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP1);
}
@@ -1727,7 +1729,7 @@ static int ixgbe_request_msix_irqs(struct ixgbe_adapter *adapter)
handler, 0, adapter->name[vector],
adapter->q_vector[vector]);
if (err) {
- DPRINTK(PROBE, ERR,
+ netif_err(adapter, probe, adapter->netdev,
"request_irq failed for MSIX interrupt "
"Error: %d\n", err);
goto free_queue_irqs;
@@ -1738,7 +1740,7 @@ static int ixgbe_request_msix_irqs(struct ixgbe_adapter *adapter)
err = request_irq(adapter->msix_entries[vector].vector,
ixgbe_msix_lsc, 0, adapter->name[vector], netdev);
if (err) {
- DPRINTK(PROBE, ERR,
+ netif_err(adapter, probe, adapter->netdev,
"request_irq for msix_lsc failed: %d\n", err);
goto free_queue_irqs;
}
@@ -1922,7 +1924,7 @@ static int ixgbe_request_irq(struct ixgbe_adapter *adapter)
}

if (err)
- DPRINTK(PROBE, ERR, "request_irq failed, Error %d\n", err);
+ netif_err(adapter, probe, adapter->netdev, "request_irq failed, Error %d\n", err);

return err;
}
@@ -1993,7 +1995,7 @@ static void ixgbe_configure_msi_and_legacy(struct ixgbe_adapter *adapter)
map_vector_to_rxq(adapter, 0, 0);
map_vector_to_txq(adapter, 0, 0);

- DPRINTK(HW, INFO, "Legacy interrupt IVAR setup done\n");
+ netif_info(adapter, hw, adapter->netdev, "Legacy interrupt IVAR setup done\n");
}

/**
@@ -2808,7 +2810,7 @@ static inline void ixgbe_rx_desc_queue_enable(struct ixgbe_adapter *adapter,
msleep(1);
}
if (k >= IXGBE_MAX_RX_DESC_POLL) {
- DPRINTK(DRV, ERR, "RXDCTL.ENABLE on Rx queue %d "
+ netif_err(adapter, drv, adapter->netdev, "RXDCTL.ENABLE on Rx queue %d "
"not set within the polling period\n", rxr);
}
ixgbe_release_rx_desc(&adapter->hw, adapter->rx_ring[rxr],
@@ -2926,7 +2928,7 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter)
} while (--wait_loop &&
!(txdctl & IXGBE_TXDCTL_ENABLE));
if (!wait_loop)
- DPRINTK(DRV, ERR, "Could not enable "
+ netif_err(adapter, drv, adapter->netdev, "Could not enable "
"Tx Queue %d\n", j);
}
}
@@ -2971,7 +2973,7 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter)
if (adapter->flags & IXGBE_FLAG_FAN_FAIL_CAPABLE) {
u32 esdp = IXGBE_READ_REG(hw, IXGBE_ESDP);
if (esdp & IXGBE_ESDP_SDP1)
- DPRINTK(DRV, CRIT,
+ netif_crit(adapter, drv, adapter->netdev,
"Fan has stopped, replace the adapter\n");
}

@@ -3001,7 +3003,7 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter)
} else {
err = ixgbe_non_sfp_link_config(hw);
if (err)
- DPRINTK(PROBE, ERR, "link_config FAILED %d\n", err);
+ netif_err(adapter, probe, adapter->netdev, "link_config FAILED %d\n", err);
}

for (i = 0; i < adapter->num_tx_queues; i++)
@@ -3429,12 +3431,12 @@ static inline bool ixgbe_set_fcoe_queues(struct ixgbe_adapter *adapter)
adapter->num_tx_queues = 1;
#ifdef CONFIG_IXGBE_DCB
if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
- DPRINTK(PROBE, INFO, "FCoE enabled with DCB \n");
+ netif_info(adapter, probe, adapter->netdev, "FCoE enabled with DCB \n");
ixgbe_set_dcb_queues(adapter);
}
#endif
if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) {
- DPRINTK(PROBE, INFO, "FCoE enabled with RSS \n");
+ netif_info(adapter, probe, adapter->netdev, "FCoE enabled with RSS \n");
if ((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) ||
(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE))
ixgbe_set_fdir_queues(adapter);
@@ -3547,7 +3549,7 @@ static void ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter,
* This just means we'll go with either a single MSI
* vector or fall back to legacy interrupts.
*/
- DPRINTK(HW, DEBUG, "Unable to allocate MSI-X interrupts\n");
+ netif_printk(adapter, hw, KERN_DEBUG, adapter->netdev, "Unable to allocate MSI-X interrupts\n");
adapter->flags &= ~IXGBE_FLAG_MSIX_ENABLED;
kfree(adapter->msix_entries);
adapter->msix_entries = NULL;
@@ -3944,8 +3946,9 @@ static int ixgbe_set_interrupt_capability(struct ixgbe_adapter *adapter)
if (!err) {
adapter->flags |= IXGBE_FLAG_MSI_ENABLED;
} else {
- DPRINTK(HW, DEBUG, "Unable to allocate MSI interrupt, "
- "falling back to legacy. Error: %d\n", err);
+ netif_printk(adapter, hw, KERN_DEBUG, adapter->netdev,
+ "Unable to allocate MSI interrupt, "
+ "falling back to legacy. Error: %d\n", err);
/* reset err */
err = 0;
}
@@ -4067,24 +4070,24 @@ int ixgbe_init_interrupt_scheme(struct ixgbe_adapter *adapter)

err = ixgbe_set_interrupt_capability(adapter);
if (err) {
- DPRINTK(PROBE, ERR, "Unable to setup interrupt capabilities\n");
+ netif_err(adapter, probe, adapter->netdev, "Unable to setup interrupt capabilities\n");
goto err_set_interrupt;
}

err = ixgbe_alloc_q_vectors(adapter);
if (err) {
- DPRINTK(PROBE, ERR, "Unable to allocate memory for queue "
+ netif_err(adapter, probe, adapter->netdev, "Unable to allocate memory for queue "
"vectors\n");
goto err_alloc_q_vectors;
}

err = ixgbe_alloc_queues(adapter);
if (err) {
- DPRINTK(PROBE, ERR, "Unable to allocate memory for queues\n");
+ netif_err(adapter, probe, adapter->netdev, "Unable to allocate memory for queues\n");
goto err_alloc_queues;
}

- DPRINTK(DRV, INFO, "Multiqueue %s: Rx Queue count = %u, "
+ netif_info(adapter, drv, adapter->netdev, "Multiqueue %s: Rx Queue count = %u, "
"Tx Queue count = %u\n",
(adapter->num_rx_queues > 1) ? "Enabled" :
"Disabled", adapter->num_rx_queues, adapter->num_tx_queues);
@@ -4165,7 +4168,7 @@ static void ixgbe_sfp_task(struct work_struct *work)
"supported module.\n");
unregister_netdev(adapter->netdev);
} else {
- DPRINTK(PROBE, INFO, "detected SFP+: %d\n",
+ netif_info(adapter, probe, adapter->netdev, "detected SFP+: %d\n",
hw->phy.sfp_type);
}
/* don't need this routine any more */
@@ -4344,7 +4347,7 @@ int ixgbe_setup_tx_resources(struct ixgbe_adapter *adapter,
err:
vfree(tx_ring->tx_buffer_info);
tx_ring->tx_buffer_info = NULL;
- DPRINTK(PROBE, ERR, "Unable to allocate memory for the transmit "
+ netif_err(adapter, probe, adapter->netdev, "Unable to allocate memory for the transmit "
"descriptor ring\n");
return -ENOMEM;
}
@@ -4367,7 +4370,7 @@ static int ixgbe_setup_all_tx_resources(struct ixgbe_adapter *adapter)
err = ixgbe_setup_tx_resources(adapter, adapter->tx_ring[i]);
if (!err)
continue;
- DPRINTK(PROBE, ERR, "Allocation for Tx Queue %u failed\n", i);
+ netif_err(adapter, probe, adapter->netdev, "Allocation for Tx Queue %u failed\n", i);
break;
}

@@ -4392,7 +4395,7 @@ int ixgbe_setup_rx_resources(struct ixgbe_adapter *adapter,
if (!rx_ring->rx_buffer_info)
rx_ring->rx_buffer_info = vmalloc(size);
if (!rx_ring->rx_buffer_info) {
- DPRINTK(PROBE, ERR,
+ netif_err(adapter, probe, adapter->netdev,
"vmalloc allocation failed for the rx desc ring\n");
goto alloc_failed;
}
@@ -4405,7 +4408,7 @@ int ixgbe_setup_rx_resources(struct ixgbe_adapter *adapter,
rx_ring->desc = pci_alloc_consistent(pdev, rx_ring->size, &rx_ring->dma);

if (!rx_ring->desc) {
- DPRINTK(PROBE, ERR,
+ netif_err(adapter, probe, adapter->netdev,
"Memory allocation failed for the rx desc ring\n");
vfree(rx_ring->rx_buffer_info);
goto alloc_failed;
@@ -4439,7 +4442,7 @@ static int ixgbe_setup_all_rx_resources(struct ixgbe_adapter *adapter)
err = ixgbe_setup_rx_resources(adapter, adapter->rx_ring[i]);
if (!err)
continue;
- DPRINTK(PROBE, ERR, "Allocation for Rx Queue %u failed\n", i);
+ netif_err(adapter, probe, adapter->netdev, "Allocation for Rx Queue %u failed\n", i);
break;
}

@@ -4536,7 +4539,7 @@ static int ixgbe_change_mtu(struct net_device *netdev, int new_mtu)
if ((new_mtu < 68) || (max_frame > IXGBE_MAX_JUMBO_FRAME_SIZE))
return -EINVAL;

- DPRINTK(PROBE, INFO, "changing MTU from %d to %d\n",
+ netif_info(adapter, probe, adapter->netdev, "changing MTU from %d to %d\n",
netdev->mtu, new_mtu);
/* must set new MTU before calling down or up */
netdev->mtu = new_mtu;
@@ -4650,8 +4653,7 @@ static int ixgbe_resume(struct pci_dev *pdev)

err = pci_enable_device_mem(pdev);
if (err) {
- printk(KERN_ERR "ixgbe: Cannot enable PCI device from "
- "suspend\n");
+ pr_err("Cannot enable PCI device from suspend\n");
return err;
}
pci_set_master(pdev);
@@ -4660,8 +4662,7 @@ static int ixgbe_resume(struct pci_dev *pdev)

err = ixgbe_init_interrupt_scheme(adapter);
if (err) {
- printk(KERN_ERR "ixgbe: Cannot initialize interrupts for "
- "device\n");
+ pr_err("Cannot initialize interrupts for device\n");
return err;
}

@@ -5048,7 +5049,7 @@ static void ixgbe_fdir_reinit_task(struct work_struct *work)
set_bit(__IXGBE_FDIR_INIT_DONE,
&(adapter->tx_ring[i]->reinit_state));
} else {
- DPRINTK(PROBE, ERR, "failed to finish FDIR re-initialization, "
+ netif_err(adapter, probe, adapter->netdev, "failed to finish FDIR re-initialization, "
"ignored adding FDIR ATR filters \n");
}
/* Done FDIR Re-initialization, enable transmits */
@@ -5120,9 +5121,7 @@ static void ixgbe_watchdog_task(struct work_struct *work)
flow_tx = !!(rmcs & IXGBE_RMCS_TFCE_802_3X);
}

- printk(KERN_INFO "ixgbe: %s NIC Link is Up %s, "
- "Flow Control: %s\n",
- netdev->name,
+ netdev_info(netdev, "NIC Link is Up %s, Flow Control: %s\n",
(link_speed == IXGBE_LINK_SPEED_10GB_FULL ?
"10 Gbps" :
(link_speed == IXGBE_LINK_SPEED_1GB_FULL ?
@@ -5140,8 +5139,7 @@ static void ixgbe_watchdog_task(struct work_struct *work)
adapter->link_up = false;
adapter->link_speed = 0;
if (netif_carrier_ok(netdev)) {
- printk(KERN_INFO "ixgbe: %s NIC Link is Down\n",
- netdev->name);
+ netdev_info(netdev, "NIC Link is Down\n");
netif_carrier_off(netdev);
}
}
@@ -5317,9 +5315,9 @@ static bool ixgbe_tx_csum(struct ixgbe_adapter *adapter,
break;
default:
if (unlikely(net_ratelimit())) {
- DPRINTK(PROBE, WARNING,
- "partial checksum but proto=%x!\n",
- skb->protocol);
+ netif_warn(adapter, probe, adapter->netdev,
+ "partial checksum but proto=%x!\n",
+ skb->protocol);
}
break;
}
@@ -5913,7 +5911,7 @@ static void __devinit ixgbe_probe_vf(struct ixgbe_adapter *adapter,
adapter->flags |= IXGBE_FLAG_SRIOV_ENABLED;
err = pci_enable_sriov(adapter->pdev, adapter->num_vfs);
if (err) {
- DPRINTK(PROBE, ERR,
+ netif_err(adapter, probe, adapter->netdev,
"Failed to enable PCI sriov: %d\n", err);
goto err_novfs;
}
@@ -5938,7 +5936,7 @@ static void __devinit ixgbe_probe_vf(struct ixgbe_adapter *adapter,
}

/* Oh oh */
- DPRINTK(PROBE, ERR,
+ netif_err(adapter, probe, adapter->netdev,
"Unable to allocate memory for VF "
"Data Storage - SRIOV disabled\n");
pci_disable_sriov(adapter->pdev);
@@ -6099,7 +6097,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
if (adapter->flags & IXGBE_FLAG_FAN_FAIL_CAPABLE) {
u32 esdp = IXGBE_READ_REG(hw, IXGBE_ESDP);
if (esdp & IXGBE_ESDP_SDP1)
- DPRINTK(PROBE, CRIT,
+ netif_crit(adapter, probe, adapter->netdev,
"Fan has stopped, replace the adapter\n");
}

@@ -6279,7 +6277,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
}
#endif
if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) {
- DPRINTK(PROBE, INFO, "IOV is enabled with %d VFs\n",
+ netif_info(adapter, probe, adapter->netdev, "IOV is enabled with %d VFs\n",
adapter->num_vfs);
for (i = 0; i < adapter->num_vfs; i++)
ixgbe_vf_configuration(pdev, (i | 0x10000000));
@@ -6378,7 +6376,7 @@ static void __devexit ixgbe_remove(struct pci_dev *pdev)
pci_release_selected_regions(pdev, pci_select_bars(pdev,
IORESOURCE_MEM));

- DPRINTK(PROBE, INFO, "complete\n");
+ netif_info(adapter, probe, adapter->netdev, "complete\n");

free_netdev(netdev);

@@ -6428,7 +6426,7 @@ static pci_ers_result_t ixgbe_io_slot_reset(struct pci_dev *pdev)
int err;

if (pci_enable_device_mem(pdev)) {
- DPRINTK(PROBE, ERR,
+ netif_err(adapter, probe, adapter->netdev,
"Cannot re-enable PCI device after reset.\n");
result = PCI_ERS_RESULT_DISCONNECT;
} else {
@@ -6467,7 +6465,7 @@ static void ixgbe_io_resume(struct pci_dev *pdev)

if (netif_running(netdev)) {
if (ixgbe_up(adapter)) {
- DPRINTK(PROBE, INFO, "ixgbe_up failed after reset\n");
+ netif_info(adapter, probe, adapter->netdev, "ixgbe_up failed after reset\n");
return;
}
}
@@ -6503,10 +6501,8 @@ static struct pci_driver ixgbe_driver = {
static int __init ixgbe_init_module(void)
{
int ret;
- printk(KERN_INFO "%s: %s - version %s\n", ixgbe_driver_name,
- ixgbe_driver_string, ixgbe_driver_version);
-
- printk(KERN_INFO "%s: %s\n", ixgbe_driver_name, ixgbe_copyright);
+ pr_info("%s - version %s\n", ixgbe_driver_string, ixgbe_driver_version);
+ pr_info("%s\n", ixgbe_copyright);

#ifdef CONFIG_IXGBE_DCA
dca_register_notify(&dca_notifier);
@@ -6545,18 +6541,6 @@ static int ixgbe_notify_dca(struct notifier_block *nb, unsigned long event,
}

#endif /* CONFIG_IXGBE_DCA */
-#ifdef DEBUG
-/**
- * ixgbe_get_hw_dev_name - return device name string
- * used by hardware layer to print debugging information
- **/
-char *ixgbe_get_hw_dev_name(struct ixgbe_hw *hw)
-{
- struct ixgbe_adapter *adapter = hw->back;
- return adapter->netdev->name;
-}
-
-#endif
module_exit(ixgbe_exit_module);

/* ixgbe_main.c */
diff --git a/drivers/net/ixgbe/ixgbe_phy.c b/drivers/net/ixgbe/ixgbe_phy.c
index 1c1efd3..33b7cfc 100644
--- a/drivers/net/ixgbe/ixgbe_phy.c
+++ b/drivers/net/ixgbe/ixgbe_phy.c
@@ -28,7 +28,9 @@
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/sched.h>
+#include <linux/netdevice.h>

+#include "ixgbe.h"
#include "ixgbe_common.h"
#include "ixgbe_phy.h"

diff --git a/drivers/net/ixgbe/ixgbe_sriov.c b/drivers/net/ixgbe/ixgbe_sriov.c
index d4cd20f..068c031 100644
--- a/drivers/net/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ixgbe/ixgbe_sriov.c
@@ -25,6 +25,7 @@

*******************************************************************************/

+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/types.h>
#include <linux/module.h>
@@ -152,7 +153,7 @@ int ixgbe_set_vf_mac(struct ixgbe_adapter *adapter,
adapter->vfinfo[vf].rar = hw->mac.ops.set_rar(hw, vf + 1, mac_addr,
vf, IXGBE_RAH_AV);
if (adapter->vfinfo[vf].rar < 0) {
- DPRINTK(DRV, ERR, "Could not set MAC Filter for VF %d\n", vf);
+ netif_err(adapter, drv, adapter->netdev, "Could not set MAC Filter for VF %d\n", vf);
return -1;
}

@@ -172,7 +173,7 @@ int ixgbe_vf_configuration(struct pci_dev *pdev, unsigned int event_mask)

if (enable) {
random_ether_addr(vf_mac_addr);
- DPRINTK(PROBE, INFO, "IOV: VF %d is enabled "
+ netif_info(adapter, probe, adapter->netdev, "IOV: VF %d is enabled "
"mac %02X:%02X:%02X:%02X:%02X:%02X\n",
vfn,
vf_mac_addr[0], vf_mac_addr[1], vf_mac_addr[2],
@@ -221,7 +222,7 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)
retval = ixgbe_read_mbx(hw, msgbuf, mbx_size, vf);

if (retval)
- printk(KERN_ERR "Error receiving message from VF\n");
+ pr_err("Error receiving message from VF\n");

/* this is a message we already processed, do nothing */
if (msgbuf[0] & (IXGBE_VT_MSGTYPE_ACK | IXGBE_VT_MSGTYPE_NACK))
@@ -235,7 +236,7 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)
if (msgbuf[0] == IXGBE_VF_RESET) {
unsigned char *vf_mac = adapter->vfinfo[vf].vf_mac_addresses;
u8 *addr = (u8 *)(&msgbuf[1]);
- DPRINTK(PROBE, INFO, "VF Reset msg received from vf %d\n", vf);
+ netif_info(adapter, probe, adapter->netdev, "VF Reset msg received from vf %d\n", vf);
adapter->vfinfo[vf].clear_to_send = false;
ixgbe_vf_reset_msg(adapter, vf);
adapter->vfinfo[vf].clear_to_send = true;
@@ -286,7 +287,7 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)
retval = ixgbe_set_vf_vlan(adapter, add, vid, vf);
break;
default:
- DPRINTK(DRV, ERR, "Unhandled Msg %8.8x\n", msgbuf[0]);
+ netif_err(adapter, drv, adapter->netdev, "Unhandled Msg %8.8x\n", msgbuf[0]);
retval = IXGBE_ERR_MBX;
break;
}
--
1.7.0.14.g7e948

2010-02-23 02:57:20

by Joe Perches

[permalink] [raw]
Subject: [PATCH net-next 2/7] drivers/net/myri10ge: Use pr_<level> and netdev_<level>

Add #define pr_fmt(fmt)
Convert logging messages to pr_<level> and netdev_<level>

Signed-off-by: Joe Perches <[email protected]>
---
drivers/net/myri10ge/myri10ge.c | 183 ++++++++++++++-------------------------
1 files changed, 67 insertions(+), 116 deletions(-)

diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index c0884a9..1d14a8b 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -38,6 +38,8 @@
* Myricom, Inc., 325N Santa Anita Avenue, Arcadia, CA 91006
*************************************************************************/

+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include <linux/tcp.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
@@ -819,9 +821,7 @@ static int myri10ge_change_pause(struct myri10ge_priv *mgp, int pause)
status = myri10ge_send_cmd(mgp, ctl, &cmd, 0);

if (status) {
- printk(KERN_ERR
- "myri10ge: %s: Failed to set flow control mode\n",
- mgp->dev->name);
+ netdev_err(mgp->dev, "Failed to set flow control mode\n");
return status;
}
mgp->pause = pause;
@@ -837,8 +837,7 @@ myri10ge_change_promisc(struct myri10ge_priv *mgp, int promisc, int atomic)
ctl = promisc ? MXGEFW_ENABLE_PROMISC : MXGEFW_DISABLE_PROMISC;
status = myri10ge_send_cmd(mgp, ctl, &cmd, atomic);
if (status)
- printk(KERN_ERR "myri10ge: %s: Failed to set promisc mode\n",
- mgp->dev->name);
+ netdev_err(mgp->dev, "Failed to set promisc mode\n");
}

static int myri10ge_dma_test(struct myri10ge_priv *mgp, int test_type)
@@ -1482,19 +1481,15 @@ static inline void myri10ge_check_statblock(struct myri10ge_priv *mgp)

if (mgp->link_state == MXGEFW_LINK_UP) {
if (netif_msg_link(mgp))
- printk(KERN_INFO
- "myri10ge: %s: link up\n",
- mgp->dev->name);
+ netdev_info(mgp->dev, "link up\n");
netif_carrier_on(mgp->dev);
mgp->link_changes++;
} else {
if (netif_msg_link(mgp))
- printk(KERN_INFO
- "myri10ge: %s: link %s\n",
- mgp->dev->name,
- (link_up == MXGEFW_LINK_MYRINET ?
- "mismatch (Myrinet detected)" :
- "down"));
+ netdev_info(mgp->dev, "link %s\n",
+ link_up == MXGEFW_LINK_MYRINET ?
+ "mismatch (Myrinet detected)" :
+ "down");
netif_carrier_off(mgp->dev);
mgp->link_changes++;
}
@@ -1503,9 +1498,8 @@ static inline void myri10ge_check_statblock(struct myri10ge_priv *mgp)
ntohl(stats->rdma_tags_available)) {
mgp->rdma_tags_available =
ntohl(stats->rdma_tags_available);
- printk(KERN_WARNING "myri10ge: %s: RDMA timed out! "
- "%d tags left\n", mgp->dev->name,
- mgp->rdma_tags_available);
+ netdev_warn(mgp->dev, "RDMA timed out! %d tags left\n",
+ mgp->rdma_tags_available);
}
mgp->down_cnt += stats->link_down;
if (stats->link_down)
@@ -1576,8 +1570,7 @@ static irqreturn_t myri10ge_intr(int irq, void *arg)
if (send_done_count != tx->pkt_done)
myri10ge_tx_done(ss, (int)send_done_count);
if (unlikely(i > myri10ge_max_irq_loops)) {
- printk(KERN_WARNING "myri10ge: %s: irq stuck?\n",
- mgp->dev->name);
+ netdev_err(mgp->dev, "irq stuck?\n");
stats->valid = 0;
schedule_work(&mgp->watchdog_work);
}
@@ -1614,16 +1607,14 @@ myri10ge_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd)
*/
ptr = mgp->product_code_string;
if (ptr == NULL) {
- printk(KERN_ERR "myri10ge: %s: Missing product code\n",
- netdev->name);
+ netdev_err(netdev, "Missing product code\n");
return 0;
}
for (i = 0; i < 3; i++, ptr++) {
ptr = strchr(ptr, '-');
if (ptr == NULL) {
- printk(KERN_ERR "myri10ge: %s: Invalid product "
- "code %s\n", netdev->name,
- mgp->product_code_string);
+ netdev_err(netdev, "Invalid product code %s\n",
+ mgp->product_code_string);
return 0;
}
}
@@ -2009,17 +2000,15 @@ static int myri10ge_allocate_rings(struct myri10ge_slice_state *ss)
mgp->small_bytes + MXGEFW_PAD, 0);

if (ss->rx_small.fill_cnt < ss->rx_small.mask + 1) {
- printk(KERN_ERR
- "myri10ge: %s:slice-%d: alloced only %d small bufs\n",
- dev->name, slice, ss->rx_small.fill_cnt);
+ netdev_err(dev, "slice-%d: alloced only %d small bufs\n",
+ slice, ss->rx_small.fill_cnt);
goto abort_with_rx_small_ring;
}

myri10ge_alloc_rx_pages(mgp, &ss->rx_big, mgp->big_bytes, 0);
if (ss->rx_big.fill_cnt < ss->rx_big.mask + 1) {
- printk(KERN_ERR
- "myri10ge: %s:slice-%d: alloced only %d big bufs\n",
- dev->name, slice, ss->rx_big.fill_cnt);
+ netdev_err(dev, "slice-%d: alloced only %d big bufs\n",
+ slice, ss->rx_big.fill_cnt);
goto abort_with_rx_big_ring;
}

@@ -2358,7 +2347,7 @@ static int myri10ge_open(struct net_device *dev)
mgp->running = MYRI10GE_ETH_STARTING;
status = myri10ge_reset(mgp);
if (status != 0) {
- printk(KERN_ERR "myri10ge: %s: failed reset\n", dev->name);
+ netdev_err(dev, "failed reset\n");
goto abort_with_nothing;
}

@@ -2370,9 +2359,7 @@ static int myri10ge_open(struct net_device *dev)
status = myri10ge_send_cmd(mgp, MXGEFW_CMD_ENABLE_RSS_QUEUES,
&cmd, 0);
if (status != 0) {
- printk(KERN_ERR
- "myri10ge: %s: failed to set number of slices\n",
- dev->name);
+ netdev_err(dev, "failed to set number of slices\n");
goto abort_with_nothing;
}
/* setup the indirection table */
@@ -2384,9 +2371,7 @@ static int myri10ge_open(struct net_device *dev)
MXGEFW_CMD_GET_RSS_TABLE_OFFSET,
&cmd, 0);
if (status != 0) {
- printk(KERN_ERR
- "myri10ge: %s: failed to setup rss tables\n",
- dev->name);
+ netdev_err(dev, "failed to setup rss tables\n");
goto abort_with_nothing;
}

@@ -2400,9 +2385,7 @@ static int myri10ge_open(struct net_device *dev)
status = myri10ge_send_cmd(mgp, MXGEFW_CMD_SET_RSS_ENABLE,
&cmd, 0);
if (status != 0) {
- printk(KERN_ERR
- "myri10ge: %s: failed to enable slices\n",
- dev->name);
+ netdev_err(dev, "failed to enable slices\n");
goto abort_with_nothing;
}
}
@@ -2450,9 +2433,7 @@ static int myri10ge_open(struct net_device *dev)

status = myri10ge_get_txrx(mgp, slice);
if (status != 0) {
- printk(KERN_ERR
- "myri10ge: %s: failed to get ring sizes or locations\n",
- dev->name);
+ netdev_err(dev, "failed to get ring sizes or locations\n");
goto abort_with_rings;
}
status = myri10ge_allocate_rings(ss);
@@ -2465,9 +2446,7 @@ static int myri10ge_open(struct net_device *dev)
if (slice == 0 || mgp->dev->real_num_tx_queues > 1)
status = myri10ge_set_stats(mgp, slice);
if (status) {
- printk(KERN_ERR
- "myri10ge: %s: Couldn't set stats DMA\n",
- dev->name);
+ netdev_err(dev, "Couldn't set stats DMA\n");
goto abort_with_rings;
}

@@ -2498,8 +2477,7 @@ static int myri10ge_open(struct net_device *dev)
status |=
myri10ge_send_cmd(mgp, MXGEFW_CMD_SET_BIG_BUFFER_SIZE, &cmd, 0);
if (status) {
- printk(KERN_ERR "myri10ge: %s: Couldn't set buffer sizes\n",
- dev->name);
+ netdev_err(dev, "Couldn't set buffer sizes\n");
goto abort_with_rings;
}

@@ -2511,8 +2489,7 @@ static int myri10ge_open(struct net_device *dev)
cmd.data0 = 0;
status = myri10ge_send_cmd(mgp, MXGEFW_CMD_SET_TSO_MODE, &cmd, 0);
if (status && status != -ENOSYS) {
- printk(KERN_ERR "myri10ge: %s: Couldn't set TSO mode\n",
- dev->name);
+ netdev_err(dev, "Couldn't set TSO mode\n");
goto abort_with_rings;
}

@@ -2521,8 +2498,7 @@ static int myri10ge_open(struct net_device *dev)

status = myri10ge_send_cmd(mgp, MXGEFW_CMD_ETHERNET_UP, &cmd, 0);
if (status) {
- printk(KERN_ERR "myri10ge: %s: Couldn't bring up link\n",
- dev->name);
+ netdev_err(dev, "Couldn't bring up link\n");
goto abort_with_rings;
}

@@ -2575,15 +2551,12 @@ static int myri10ge_close(struct net_device *dev)
status =
myri10ge_send_cmd(mgp, MXGEFW_CMD_ETHERNET_DOWN, &cmd, 0);
if (status)
- printk(KERN_ERR
- "myri10ge: %s: Couldn't bring down link\n",
- dev->name);
+ netdev_err(dev, "Couldn't bring down link\n");

wait_event_timeout(mgp->down_wq, old_down_cnt != mgp->down_cnt,
HZ);
if (old_down_cnt == mgp->down_cnt)
- printk(KERN_ERR "myri10ge: %s never got down irq\n",
- dev->name);
+ netdev_err(dev, "never got down irq\n");
}
netif_tx_disable(dev);
myri10ge_free_irq(mgp);
@@ -2944,9 +2917,7 @@ abort_linearize:
idx = (idx + 1) & tx->mask;
} while (idx != last_idx);
if (skb_is_gso(skb)) {
- printk(KERN_ERR
- "myri10ge: %s: TSO but wanted to linearize?!?!?\n",
- mgp->dev->name);
+ netdev_err(mgp->dev, "TSO but wanted to linearize?!?!?\n");
goto drop;
}

@@ -3043,8 +3014,8 @@ static void myri10ge_set_multicast_list(struct net_device *dev)

err = myri10ge_send_cmd(mgp, MXGEFW_ENABLE_ALLMULTI, &cmd, 1);
if (err != 0) {
- printk(KERN_ERR "myri10ge: %s: Failed MXGEFW_ENABLE_ALLMULTI,"
- " error status: %d\n", dev->name, err);
+ netdev_err(dev, "Failed MXGEFW_ENABLE_ALLMULTI, error status: %d\n",
+ err);
goto abort;
}

@@ -3058,9 +3029,8 @@ static void myri10ge_set_multicast_list(struct net_device *dev)
err = myri10ge_send_cmd(mgp, MXGEFW_LEAVE_ALL_MULTICAST_GROUPS,
&cmd, 1);
if (err != 0) {
- printk(KERN_ERR
- "myri10ge: %s: Failed MXGEFW_LEAVE_ALL_MULTICAST_GROUPS"
- ", error status: %d\n", dev->name, err);
+ netdev_err(dev, "Failed MXGEFW_LEAVE_ALL_MULTICAST_GROUPS, error status: %d\n",
+ err);
goto abort;
}

@@ -3073,18 +3043,16 @@ static void myri10ge_set_multicast_list(struct net_device *dev)
&cmd, 1);

if (err != 0) {
- printk(KERN_ERR "myri10ge: %s: Failed "
- "MXGEFW_JOIN_MULTICAST_GROUP, error status:"
- "%d\t", dev->name, err);
- printk(KERN_ERR "MAC %pM\n", mc_list->dmi_addr);
+ netdev_err(dev, "Failed MXGEFW_JOIN_MULTICAST_GROUP, error status:%d %pM\n",
+ err, mc_list->dmi_addr);
goto abort;
}
}
/* Enable multicast filtering */
err = myri10ge_send_cmd(mgp, MXGEFW_DISABLE_ALLMULTI, &cmd, 1);
if (err != 0) {
- printk(KERN_ERR "myri10ge: %s: Failed MXGEFW_DISABLE_ALLMULTI,"
- "error status: %d\n", dev->name, err);
+ netdev_err(dev, "Failed MXGEFW_DISABLE_ALLMULTI, error status: %d\n",
+ err);
goto abort;
}

@@ -3105,9 +3073,8 @@ static int myri10ge_set_mac_address(struct net_device *dev, void *addr)

status = myri10ge_update_mac_address(mgp, sa->sa_data);
if (status != 0) {
- printk(KERN_ERR
- "myri10ge: %s: changing mac address failed with %d\n",
- dev->name, status);
+ netdev_err(dev, "changing mac address failed with %d\n",
+ status);
return status;
}

@@ -3122,12 +3089,10 @@ static int myri10ge_change_mtu(struct net_device *dev, int new_mtu)
int error = 0;

if ((new_mtu < 68) || (ETH_HLEN + new_mtu > MYRI10GE_MAX_ETHER_MTU)) {
- printk(KERN_ERR "myri10ge: %s: new mtu (%d) is not valid\n",
- dev->name, new_mtu);
+ netdev_err(dev, "new mtu (%d) is not valid\n", new_mtu);
return -EINVAL;
}
- printk(KERN_INFO "%s: changing mtu from %d to %d\n",
- dev->name, dev->mtu, new_mtu);
+ netdev_info(dev, "changing mtu from %d to %d\n", dev->mtu, new_mtu);
if (mgp->running) {
/* if we change the mtu on an active device, we must
* reset the device so the firmware sees the change */
@@ -3356,7 +3321,7 @@ static int myri10ge_suspend(struct pci_dev *pdev, pm_message_t state)

netif_device_detach(netdev);
if (netif_running(netdev)) {
- printk(KERN_INFO "myri10ge: closing %s\n", netdev->name);
+ netdev_info(netdev, "closing\n");
rtnl_lock();
myri10ge_close(netdev);
rtnl_unlock();
@@ -3383,8 +3348,7 @@ static int myri10ge_resume(struct pci_dev *pdev)
msleep(5); /* give card time to respond */
pci_read_config_word(mgp->pdev, PCI_VENDOR_ID, &vendor);
if (vendor == 0xffff) {
- printk(KERN_ERR "myri10ge: %s: device disappeared!\n",
- mgp->dev->name);
+ netdev_err(mgp->dev, "device disappeared!\n");
return -EIO;
}

@@ -3463,10 +3427,9 @@ static void myri10ge_watchdog(struct work_struct *work)
* if the card rebooted due to a parity error
* For now, just report it */
reboot = myri10ge_read_reboot(mgp);
- printk(KERN_ERR
- "myri10ge: %s: NIC rebooted (0x%x),%s resetting\n",
- mgp->dev->name, reboot,
- myri10ge_reset_recover ? " " : " not");
+ netdev_err(mgp->dev, "NIC rebooted (0x%x),%s resetting\n",
+ reboot,
+ myri10ge_reset_recover ? "" : " not");
if (myri10ge_reset_recover == 0)
return;
rtnl_lock();
@@ -3494,31 +3457,26 @@ static void myri10ge_watchdog(struct work_struct *work)
if (cmd == 0xffff) {
pci_read_config_word(mgp->pdev, PCI_VENDOR_ID, &vendor);
if (vendor == 0xffff) {
- printk(KERN_ERR
- "myri10ge: %s: device disappeared!\n",
- mgp->dev->name);
+ netdev_err(mgp->dev, "device disappeared!\n");
return;
}
}
/* Perhaps it is a software error. Try to reset */

- printk(KERN_ERR "myri10ge: %s: device timeout, resetting\n",
- mgp->dev->name);
+ netdev_err(mgp->dev, "device timeout, resetting\n");
for (i = 0; i < mgp->num_slices; i++) {
tx = &mgp->ss[i].tx;
- printk(KERN_INFO
- "myri10ge: %s: (%d): %d %d %d %d %d %d\n",
- mgp->dev->name, i, tx->queue_active, tx->req,
- tx->done, tx->pkt_start, tx->pkt_done,
- (int)ntohl(mgp->ss[i].fw_stats->
- send_done_count));
+ netdev_err(mgp->dev, "(%d): %d %d %d %d %d %d\n",
+ i, tx->queue_active, tx->req,
+ tx->done, tx->pkt_start, tx->pkt_done,
+ (int)ntohl(mgp->ss[i].fw_stats->
+ send_done_count));
msleep(2000);
- printk(KERN_INFO
- "myri10ge: %s: (%d): %d %d %d %d %d %d\n",
- mgp->dev->name, i, tx->queue_active, tx->req,
- tx->done, tx->pkt_start, tx->pkt_done,
- (int)ntohl(mgp->ss[i].fw_stats->
- send_done_count));
+ netdev_info(mgp->dev, "(%d): %d %d %d %d %d %d\n",
+ i, tx->queue_active, tx->req,
+ tx->done, tx->pkt_start, tx->pkt_done,
+ (int)ntohl(mgp->ss[i].fw_stats->
+ send_done_count));
}
}

@@ -3528,8 +3486,7 @@ static void myri10ge_watchdog(struct work_struct *work)
}
status = myri10ge_load_firmware(mgp, 1);
if (status != 0)
- printk(KERN_ERR "myri10ge: %s: failed to load firmware\n",
- mgp->dev->name);
+ netdev_err(mgp->dev, "failed to load firmware\n");
else
myri10ge_open(mgp->dev);
rtnl_unlock();
@@ -3580,14 +3537,10 @@ static void myri10ge_watchdog_timer(unsigned long arg)
/* nic seems like it might be stuck.. */
if (rx_pause_cnt != mgp->watchdog_pause) {
if (net_ratelimit())
- printk(KERN_WARNING
- "myri10ge %s slice %d:"
- "TX paused, check link partner\n",
- mgp->dev->name, i);
+ netdev_err(mgp->dev, "slice %d: TX paused, check link partner\n",
+ i);
} else {
- printk(KERN_WARNING
- "myri10ge %s slice %d stuck:",
- mgp->dev->name, i);
+ netdev_warn(mgp->dev, "slice %d stuck:", i);
reset_needed = 1;
}
}
@@ -4127,13 +4080,11 @@ static struct notifier_block myri10ge_dca_notifier = {

static __init int myri10ge_init_module(void)
{
- printk(KERN_INFO "%s: Version %s\n", myri10ge_driver.name,
- MYRI10GE_VERSION_STR);
+ pr_info("Version %s\n", MYRI10GE_VERSION_STR);

if (myri10ge_rss_hash > MXGEFW_RSS_HASH_TYPE_MAX) {
- printk(KERN_ERR
- "%s: Illegal rssh hash type %d, defaulting to source port\n",
- myri10ge_driver.name, myri10ge_rss_hash);
+ pr_err("Illegal rssh hash type %d, defaulting to source port\n",
+ myri10ge_rss_hash);
myri10ge_rss_hash = MXGEFW_RSS_HASH_TYPE_SRC_PORT;
}
#ifdef CONFIG_MYRI10GE_DCA
--
1.7.0.14.g7e948

2010-02-23 19:17:10

by Allan, Bruce W

[permalink] [raw]
Subject: RE: [PATCH net-next 6/7] drivers/net/e1000e: Use pr_<level> and netdev_<level>

On Monday, February 22, 2010 6:57 PM, Joe Perches wrote:
> Convert e_<level> to netdev_<level>
> Remove #define PFX
> Use #define pr_fmt
> Convert a few printks to pr_<level>
> Coalesce long formats
> Typo spelling fix
>
> Signed-off-by: Joe Perches <[email protected]>
> ---
> drivers/net/e1000e/82571.c | 57 +++++++++++-------
> drivers/net/e1000e/e1000.h | 21 -------
> drivers/net/e1000e/es2lan.c | 27 +++++----
> drivers/net/e1000e/ethtool.c | 37 ++++++------
> drivers/net/e1000e/ich8lan.c | 90 +++++++++++++++++------------
> drivers/net/e1000e/lib.c | 131
> +++++++++++++++++++++---------------------
> drivers/net/e1000e/netdev.c | 95 +++++++++++++++---------------
> drivers/net/e1000e/param.c | 20 +++--- drivers/net/e1000e/phy.c
> | 114 ++++++++++++++++++------------------ 9 files changed, 302
> insertions(+), 290 deletions(-)
>

As an alternative to Joe's large patch to e1000e, I would like to suggest the following much less intrusive patch. Compile-tested only.

Convert e_<level> to netdev_<level>
Use #define pr_fmt
Convert a few printks to pr_<level>

Signed-off-by: Bruce Allan <[email protected]>
---
drivers/net/e1000e/e1000.h | 19 +++++--------------
drivers/net/e1000e/netdev.c | 9 +++++----
2 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h
index c2ec095..ecd817f 100644
--- a/drivers/net/e1000e/e1000.h
+++ b/drivers/net/e1000e/e1000.h
@@ -42,25 +42,16 @@

struct e1000_info;

-#define e_printk(level, adapter, format, arg...) \
- printk(level "%s: %s: " format, pci_name(adapter->pdev), \
- adapter->netdev->name, ## arg)
-
-#ifdef DEBUG
#define e_dbg(format, arg...) \
- e_printk(KERN_DEBUG , hw->adapter, format, ## arg)
-#else
-#define e_dbg(format, arg...) do { (void)(hw); } while (0)
-#endif
-
+ netdev_dbg(hw->adapter->netdev, format, ## arg)
#define e_err(format, arg...) \
- e_printk(KERN_ERR, adapter, format, ## arg)
+ netdev_err(adapter->netdev, format, ## arg)
#define e_info(format, arg...) \
- e_printk(KERN_INFO, adapter, format, ## arg)
+ netdev_info(adapter->netdev, format, ## arg)
#define e_warn(format, arg...) \
- e_printk(KERN_WARNING, adapter, format, ## arg)
+ netdev_warn(adapter->netdev, format, ## arg)
#define e_notice(format, arg...) \
- e_printk(KERN_NOTICE, adapter, format, ## arg)
+ netdev_notice(adapter->netdev, format, ## arg)


/* Interrupt modes, as used by the IntMode parameter */
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 88d54d3..d83c3cf 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -26,6 +26,8 @@

*******************************************************************************/

+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include <linux/module.h>
#include <linux/types.h>
#include <linux/init.h>
@@ -5403,10 +5405,9 @@ static struct pci_driver e1000_driver = {
static int __init e1000_init_module(void)
{
int ret;
- printk(KERN_INFO "%s: Intel(R) PRO/1000 Network Driver - %s\n",
- e1000e_driver_name, e1000e_driver_version);
- printk(KERN_INFO "%s: Copyright (c) 1999 - 2009 Intel Corporation.\n",
- e1000e_driver_name);
+ pr_info("Intel(R) PRO/1000 Network Driver - %s\n",
+ e1000e_driver_version);
+ pr_info("Copyright (c) 1999 - 2009 Intel Corporation.\n");
ret = pci_register_driver(&e1000_driver);

return ret;

2010-02-24 02:33:26

by Jeff Kirsher

[permalink] [raw]
Subject: Re: [PATCH net-next 0/7] drivers/net conversions to netdev_<level>, etc

On Mon, Feb 22, 2010 at 18:56, Joe Perches <[email protected]> wrote:
> Some more conversions of drivers to:
>
>    netif_<level>
>    netdev_<level>
>    pr_<level>
>
> with some other minor updates/corrections
> noticed during conversions.
>
> Joe Perches (7):
>  drivers/net/chelsio: Use pr_<level>, netif_msg_<type>
>  drivers/net/myri10ge: Use pr_<level> and netdev_<level>
>  drivers/net/ixgbe: Use pr_<level> and netif_<level>
>  drivers/net/ixgb: Use pr_<level> and netdev_<level>
>  drivers/net/e1000: Use pr_<level> and netif_<level>
>  drivers/net/e1000e: Use pr_<level> and netdev_<level>
>  drivers/net/igb: Use netdev_<level>
>
>  drivers/net/chelsio/common.h      |   24 +--
>  drivers/net/chelsio/cxgb2.c       |   18 +-
>  drivers/net/chelsio/espi.c        |    4 +-
>  drivers/net/chelsio/pm3393.c      |   16 +-
>  drivers/net/chelsio/sge.c         |   10 +-
>  drivers/net/chelsio/subr.c        |   32 ++--
>  drivers/net/chelsio/vsc7326.c     |   24 ++--
>  drivers/net/e1000/e1000.h         |   17 --
>  drivers/net/e1000/e1000_ethtool.c |   38 ++--
>  drivers/net/e1000/e1000_hw.c      |  383 ++++++++++++++++++-------------------
>  drivers/net/e1000/e1000_main.c    |  272 +++++++++++++-------------
>  drivers/net/e1000/e1000_osdep.h   |   14 +--
>  drivers/net/e1000/e1000_param.c   |  121 +++++++------
>  drivers/net/e1000e/82571.c        |   57 ++++--
>  drivers/net/e1000e/e1000.h        |   21 --
>  drivers/net/e1000e/es2lan.c       |   27 ++--
>  drivers/net/e1000e/ethtool.c      |   37 ++--
>  drivers/net/e1000e/ich8lan.c      |   90 +++++----
>  drivers/net/e1000e/lib.c          |  131 +++++++-------
>  drivers/net/e1000e/netdev.c       |   95 +++++-----
>  drivers/net/e1000e/param.c        |   20 +-
>  drivers/net/e1000e/phy.c          |  114 ++++++------
>  drivers/net/igb/e1000_82575.c     |   58 +++---
>  drivers/net/igb/e1000_hw.h        |   12 +-
>  drivers/net/igb/e1000_mac.c       |   84 ++++----
>  drivers/net/igb/e1000_nvm.c       |   22 +-
>  drivers/net/igb/e1000_phy.c       |  104 +++++-----
>  drivers/net/igb/igb.h             |    1 -
>  drivers/net/igb/igb_ethtool.c     |    6 +-
>  drivers/net/igb/igb_main.c        |   43 ++---
>  drivers/net/ixgb/ixgb.h           |    8 +-
>  drivers/net/ixgb/ixgb_ee.c        |   14 +-
>  drivers/net/ixgb/ixgb_hw.c        |  147 ++++++---------
>  drivers/net/ixgb/ixgb_hw.h        |   12 --
>  drivers/net/ixgb/ixgb_main.c      |   33 ++--
>  drivers/net/ixgb/ixgb_osdep.h     |   16 +--
>  drivers/net/ixgb/ixgb_param.c     |   31 ++--
>  drivers/net/ixgbe/ixgbe.h         |    6 -
>  drivers/net/ixgbe/ixgbe_common.h  |   15 +-
>  drivers/net/ixgbe/ixgbe_dcb_nl.c  |    5 +-
>  drivers/net/ixgbe/ixgbe_ethtool.c |   40 +++--
>  drivers/net/ixgbe/ixgbe_fcoe.c    |   25 ++--
>  drivers/net/ixgbe/ixgbe_main.c    |  110 +++++------
>  drivers/net/ixgbe/ixgbe_phy.c     |    2 +
>  drivers/net/ixgbe/ixgbe_sriov.c   |   11 +-
>  drivers/net/myri10ge/myri10ge.c   |  183 +++++++-----------
>  46 files changed, 1202 insertions(+), 1351 deletions(-)
>

I have applied patches 3-7 (the patches to Intel drivers) to my queue
of patches for review and testing.

--
Cheers,
Jeff

2010-02-26 09:39:53

by David Miller

[permalink] [raw]
Subject: Re: [PATCH net-next 1/7] drivers/net/chelsio: Use pr_<level>, netif_msg_<type>

From: Joe Perches <[email protected]>
Date: Mon, 22 Feb 2010 18:56:57 -0800

> Convert CH_<level> and CH_DBG uses to pr_<level> and netif equivalents
> Remove CH_<level> and CH_DBG macro definitions
>
> Signed-off-by: Joe Perches <[email protected]>

Applied, thanks Joe.

BTW:

> @@ -734,8 +734,9 @@ int t1_elmer0_ext_intr_handler(adapter_t *adapter)
> break;
> case CHBT_BOARD_8000:
> case CHBT_BOARD_CHT110:
> - CH_DBG(adapter, INTR, "External interrupt cause 0x%x\n",
> - cause);
> + if (netif_msg_intr(adapter))
> + dev_dbg(&adapter->pdev->dev,

Trailing whitespace on that last line. I fixed it up when
adding the patch to my tree.

2010-02-26 09:40:01

by David Miller

[permalink] [raw]
Subject: Re: [PATCH net-next 2/7] drivers/net/myri10ge: Use pr_<level> and netdev_<level>

From: Joe Perches <[email protected]>
Date: Mon, 22 Feb 2010 18:56:58 -0800

> Add #define pr_fmt(fmt)
> Convert logging messages to pr_<level> and netdev_<level>
>
> Signed-off-by: Joe Perches <[email protected]>

Applied.