Commit 7995c64e authored by Joe Perches's avatar Joe Perches Committed by David S. Miller

drivers/net/bnx2x: Use (pr|netdev|netif)_<level> macro helpers

Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
Convert struct bnx2x member msglevel to msg_enable for netif_msg_<foo> macros
Remove #define PFX
Use pr_<level>
Use netdev_<level>
Use netif_<level>
Coalesce long formats
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3a9c6a49
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
/* error/debug prints */ /* error/debug prints */
#define DRV_MODULE_NAME "bnx2x" #define DRV_MODULE_NAME "bnx2x"
#define PFX DRV_MODULE_NAME ": "
/* for messages that are currently off */ /* for messages that are currently off */
#define BNX2X_MSG_OFF 0 #define BNX2X_MSG_OFF 0
...@@ -58,30 +57,40 @@ ...@@ -58,30 +57,40 @@
#define DP_LEVEL KERN_NOTICE /* was: KERN_DEBUG */ #define DP_LEVEL KERN_NOTICE /* was: KERN_DEBUG */
/* regular debug print */ /* regular debug print */
#define DP(__mask, __fmt, __args...) do { \ #define DP(__mask, __fmt, __args...) \
if (bp->msglevel & (__mask)) \ do { \
printk(DP_LEVEL "[%s:%d(%s)]" __fmt, __func__, __LINE__, \ if (bp->msg_enable & (__mask)) \
bp->dev ? (bp->dev->name) : "?", ##__args); \ printk(DP_LEVEL "[%s:%d(%s)]" __fmt, \
} while (0) __func__, __LINE__, \
bp->dev ? (bp->dev->name) : "?", \
##__args); \
} while (0)
/* errors debug print */ /* errors debug print */
#define BNX2X_DBG_ERR(__fmt, __args...) do { \ #define BNX2X_DBG_ERR(__fmt, __args...) \
if (bp->msglevel & NETIF_MSG_PROBE) \ do { \
printk(KERN_ERR "[%s:%d(%s)]" __fmt, __func__, __LINE__, \ if (netif_msg_probe(bp)) \
bp->dev ? (bp->dev->name) : "?", ##__args); \ pr_err("[%s:%d(%s)]" __fmt, \
} while (0) __func__, __LINE__, \
bp->dev ? (bp->dev->name) : "?", \
##__args); \
} while (0)
/* for errors (never masked) */ /* for errors (never masked) */
#define BNX2X_ERR(__fmt, __args...) do { \ #define BNX2X_ERR(__fmt, __args...) \
printk(KERN_ERR "[%s:%d(%s)]" __fmt, __func__, __LINE__, \ do { \
bp->dev ? (bp->dev->name) : "?", ##__args); \ pr_err("[%s:%d(%s)]" __fmt, \
} while (0) __func__, __LINE__, \
bp->dev ? (bp->dev->name) : "?", \
##__args); \
} while (0)
/* before we have a dev->name use dev_info() */ /* before we have a dev->name use dev_info() */
#define BNX2X_DEV_INFO(__fmt, __args...) do { \ #define BNX2X_DEV_INFO(__fmt, __args...) \
if (bp->msglevel & NETIF_MSG_PROBE) \ do { \
if (netif_msg_probe(bp)) \
dev_info(&bp->pdev->dev, __fmt, ##__args); \ dev_info(&bp->pdev->dev, __fmt, ##__args); \
} while (0) } while (0)
#ifdef BNX2X_STOP_ON_ERROR #ifdef BNX2X_STOP_ON_ERROR
...@@ -882,7 +891,7 @@ struct bnx2x { ...@@ -882,7 +891,7 @@ struct bnx2x {
/* End of fields used in the performance code paths */ /* End of fields used in the performance code paths */
int panic; int panic;
int msglevel; int msg_enable;
u32 flags; u32 flags;
#define PCIX_FLAG 1 #define PCIX_FLAG 1
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
* *
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/pci.h> #include <linux/pci.h>
...@@ -2987,11 +2989,8 @@ static u8 bnx2x_verify_sfp_module(struct link_params *params) ...@@ -2987,11 +2989,8 @@ static u8 bnx2x_verify_sfp_module(struct link_params *params)
else else
vendor_pn[SFP_EEPROM_PART_NO_SIZE] = '\0'; vendor_pn[SFP_EEPROM_PART_NO_SIZE] = '\0';
printk(KERN_INFO PFX "Warning: " netdev_info(bp->dev, "Warning: Unqualified SFP+ module detected, Port %d from %s part number %s\n",
"Unqualified SFP+ module " params->port, vendor_name, vendor_pn);
"detected on %s, Port %d from %s part number %s\n"
, bp->dev->name, params->port,
vendor_name, vendor_pn);
return -EINVAL; return -EINVAL;
} }
...@@ -4846,16 +4845,8 @@ static u8 bnx2x_ext_phy_is_link_up(struct link_params *params, ...@@ -4846,16 +4845,8 @@ static u8 bnx2x_ext_phy_is_link_up(struct link_params *params,
" has been detected on " " has been detected on "
"port %d\n", "port %d\n",
params->port); params->port);
printk(KERN_ERR PFX "Error: Power" netdev_err(bp->dev, "Error: Power fault on Port %d has been detected and the power to that SFP+ module has been removed to prevent failure of the card. Please remove the SFP+ module and restart the system to clear this error.\n",
" fault on %s Port %d has" params->port);
" been detected and the"
" power to that SFP+ module"
" has been removed to prevent"
" failure of the card. Please"
" remove the SFP+ module and"
" restart the system to clear"
" this error.\n"
, bp->dev->name, params->port);
/* /*
* Disable all RX_ALARMs except for * Disable all RX_ALARMs except for
* mod_abs * mod_abs
......
...@@ -514,24 +514,24 @@ static void bnx2x_fw_dump(struct bnx2x *bp) ...@@ -514,24 +514,24 @@ static void bnx2x_fw_dump(struct bnx2x *bp)
mark = REG_RD(bp, MCP_REG_MCPR_SCRATCH + 0xf104); mark = REG_RD(bp, MCP_REG_MCPR_SCRATCH + 0xf104);
mark = ((mark + 0x3) & ~0x3); mark = ((mark + 0x3) & ~0x3);
printk(KERN_ERR PFX "begin fw dump (mark 0x%x)\n", mark); pr_err("begin fw dump (mark 0x%x)\n", mark);
printk(KERN_ERR PFX); pr_err("");
for (offset = mark - 0x08000000; offset <= 0xF900; offset += 0x8*4) { for (offset = mark - 0x08000000; offset <= 0xF900; offset += 0x8*4) {
for (word = 0; word < 8; word++) for (word = 0; word < 8; word++)
data[word] = htonl(REG_RD(bp, MCP_REG_MCPR_SCRATCH + data[word] = htonl(REG_RD(bp, MCP_REG_MCPR_SCRATCH +
offset + 4*word)); offset + 4*word));
data[8] = 0x0; data[8] = 0x0;
printk(KERN_CONT "%s", (char *)data); pr_cont("%s", (char *)data);
} }
for (offset = 0xF108; offset <= mark - 0x08000000; offset += 0x8*4) { for (offset = 0xF108; offset <= mark - 0x08000000; offset += 0x8*4) {
for (word = 0; word < 8; word++) for (word = 0; word < 8; word++)
data[word] = htonl(REG_RD(bp, MCP_REG_MCPR_SCRATCH + data[word] = htonl(REG_RD(bp, MCP_REG_MCPR_SCRATCH +
offset + 4*word)); offset + 4*word));
data[8] = 0x0; data[8] = 0x0;
printk(KERN_CONT "%s", (char *)data); pr_cont("%s", (char *)data);
} }
printk(KERN_ERR PFX "end of fw dump\n"); pr_err("end of fw dump\n");
} }
static void bnx2x_panic_dump(struct bnx2x *bp) static void bnx2x_panic_dump(struct bnx2x *bp)
...@@ -2136,7 +2136,7 @@ static void bnx2x_link_report(struct bnx2x *bp) ...@@ -2136,7 +2136,7 @@ static void bnx2x_link_report(struct bnx2x *bp)
{ {
if (bp->flags & MF_FUNC_DIS) { if (bp->flags & MF_FUNC_DIS) {
netif_carrier_off(bp->dev); netif_carrier_off(bp->dev);
printk(KERN_ERR PFX "%s NIC Link is Down\n", bp->dev->name); netdev_err(bp->dev, "NIC Link is Down\n");
return; return;
} }
...@@ -2145,7 +2145,7 @@ static void bnx2x_link_report(struct bnx2x *bp) ...@@ -2145,7 +2145,7 @@ static void bnx2x_link_report(struct bnx2x *bp)
if (bp->state == BNX2X_STATE_OPEN) if (bp->state == BNX2X_STATE_OPEN)
netif_carrier_on(bp->dev); netif_carrier_on(bp->dev);
printk(KERN_INFO PFX "%s NIC Link is Up, ", bp->dev->name); netdev_info(bp->dev, "NIC Link is Up, ");
line_speed = bp->link_vars.line_speed; line_speed = bp->link_vars.line_speed;
if (IS_E1HMF(bp)) { if (IS_E1HMF(bp)) {
...@@ -2157,29 +2157,29 @@ static void bnx2x_link_report(struct bnx2x *bp) ...@@ -2157,29 +2157,29 @@ static void bnx2x_link_report(struct bnx2x *bp)
if (vn_max_rate < line_speed) if (vn_max_rate < line_speed)
line_speed = vn_max_rate; line_speed = vn_max_rate;
} }
printk("%d Mbps ", line_speed); pr_cont("%d Mbps ", line_speed);
if (bp->link_vars.duplex == DUPLEX_FULL) if (bp->link_vars.duplex == DUPLEX_FULL)
printk("full duplex"); pr_cont("full duplex");
else else
printk("half duplex"); pr_cont("half duplex");
if (bp->link_vars.flow_ctrl != BNX2X_FLOW_CTRL_NONE) { if (bp->link_vars.flow_ctrl != BNX2X_FLOW_CTRL_NONE) {
if (bp->link_vars.flow_ctrl & BNX2X_FLOW_CTRL_RX) { if (bp->link_vars.flow_ctrl & BNX2X_FLOW_CTRL_RX) {
printk(", receive "); pr_cont(", receive ");
if (bp->link_vars.flow_ctrl & if (bp->link_vars.flow_ctrl &
BNX2X_FLOW_CTRL_TX) BNX2X_FLOW_CTRL_TX)
printk("& transmit "); pr_cont("& transmit ");
} else { } else {
printk(", transmit "); pr_cont(", transmit ");
} }
printk("flow control ON"); pr_cont("flow control ON");
} }
printk("\n"); pr_cont("\n");
} else { /* link_down */ } else { /* link_down */
netif_carrier_off(bp->dev); netif_carrier_off(bp->dev);
printk(KERN_ERR PFX "%s NIC Link is Down\n", bp->dev->name); netdev_err(bp->dev, "NIC Link is Down\n");
} }
} }
...@@ -2898,10 +2898,8 @@ static inline void bnx2x_fan_failure(struct bnx2x *bp) ...@@ -2898,10 +2898,8 @@ static inline void bnx2x_fan_failure(struct bnx2x *bp)
bp->link_params.ext_phy_config); bp->link_params.ext_phy_config);
/* log the failure */ /* log the failure */
printk(KERN_ERR PFX "Fan Failure on Network Controller %s has caused" netdev_err(bp->dev, "Fan Failure on Network Controller has caused the driver to shutdown the card to prevent permanent damage.\n"
" the driver to shutdown the card to prevent permanent" "Please contact Dell Support for assistance.\n");
" damage. Please contact Dell Support for assistance\n",
bp->dev->name);
} }
static inline void bnx2x_attn_int_deasserted0(struct bnx2x *bp, u32 attn) static inline void bnx2x_attn_int_deasserted0(struct bnx2x *bp, u32 attn)
...@@ -4296,7 +4294,7 @@ static void bnx2x_stats_update(struct bnx2x *bp) ...@@ -4296,7 +4294,7 @@ static void bnx2x_stats_update(struct bnx2x *bp)
bnx2x_net_stats_update(bp); bnx2x_net_stats_update(bp);
bnx2x_drv_stats_update(bp); bnx2x_drv_stats_update(bp);
if (bp->msglevel & NETIF_MSG_TIMER) { if (netif_msg_timer(bp)) {
struct bnx2x_fastpath *fp0_rx = bp->fp; struct bnx2x_fastpath *fp0_rx = bp->fp;
struct bnx2x_fastpath *fp0_tx = bp->fp; struct bnx2x_fastpath *fp0_tx = bp->fp;
struct tstorm_per_client_stats *old_tclient = struct tstorm_per_client_stats *old_tclient =
...@@ -4306,7 +4304,7 @@ static void bnx2x_stats_update(struct bnx2x *bp) ...@@ -4306,7 +4304,7 @@ static void bnx2x_stats_update(struct bnx2x *bp)
struct net_device_stats *nstats = &bp->dev->stats; struct net_device_stats *nstats = &bp->dev->stats;
int i; int i;
printk(KERN_DEBUG "%s:\n", bp->dev->name); netdev_printk(KERN_DEBUG, bp->dev, "\n");
printk(KERN_DEBUG " tx avail (%4x) tx hc idx (%x)" printk(KERN_DEBUG " tx avail (%4x) tx hc idx (%x)"
" tx pkt (%lx)\n", " tx pkt (%lx)\n",
bnx2x_tx_avail(fp0_tx), bnx2x_tx_avail(fp0_tx),
...@@ -4464,7 +4462,7 @@ static void bnx2x_stats_handle(struct bnx2x *bp, enum bnx2x_stats_event event) ...@@ -4464,7 +4462,7 @@ static void bnx2x_stats_handle(struct bnx2x *bp, enum bnx2x_stats_event event)
/* Make sure the state has been "changed" */ /* Make sure the state has been "changed" */
smp_wmb(); smp_wmb();
if ((event != STATS_EVENT_UPDATE) || (bp->msglevel & NETIF_MSG_TIMER)) if ((event != STATS_EVENT_UPDATE) || netif_msg_timer(bp))
DP(BNX2X_MSG_STATS, "state %d -> event %d -> state %d\n", DP(BNX2X_MSG_STATS, "state %d -> event %d -> state %d\n",
state, event, bp->stats_state); state, event, bp->stats_state);
} }
...@@ -5674,8 +5672,7 @@ gunzip_nomem2: ...@@ -5674,8 +5672,7 @@ gunzip_nomem2:
bp->gunzip_buf = NULL; bp->gunzip_buf = NULL;
gunzip_nomem1: gunzip_nomem1:
printk(KERN_ERR PFX "%s: Cannot allocate firmware buffer for" netdev_err(bp->dev, "Cannot allocate firmware buffer for un-compression\n");
" un-compression\n", bp->dev->name);
return -ENOMEM; return -ENOMEM;
} }
...@@ -5721,14 +5718,13 @@ static int bnx2x_gunzip(struct bnx2x *bp, const u8 *zbuf, int len) ...@@ -5721,14 +5718,13 @@ static int bnx2x_gunzip(struct bnx2x *bp, const u8 *zbuf, int len)
rc = zlib_inflate(bp->strm, Z_FINISH); rc = zlib_inflate(bp->strm, Z_FINISH);
if ((rc != Z_OK) && (rc != Z_STREAM_END)) if ((rc != Z_OK) && (rc != Z_STREAM_END))
printk(KERN_ERR PFX "%s: Firmware decompression error: %s\n", netdev_err(bp->dev, "Firmware decompression error: %s\n",
bp->dev->name, bp->strm->msg); bp->strm->msg);
bp->gunzip_outlen = (FW_BUF_SIZE - bp->strm->avail_out); bp->gunzip_outlen = (FW_BUF_SIZE - bp->strm->avail_out);
if (bp->gunzip_outlen & 0x3) if (bp->gunzip_outlen & 0x3)
printk(KERN_ERR PFX "%s: Firmware decompression error:" netdev_err(bp->dev, "Firmware decompression error: gunzip_outlen (%d) not aligned\n",
" gunzip_outlen (%d) not aligned\n", bp->gunzip_outlen);
bp->dev->name, bp->gunzip_outlen);
bp->gunzip_outlen >>= 2; bp->gunzip_outlen >>= 2;
zlib_inflateEnd(bp->strm); zlib_inflateEnd(bp->strm);
...@@ -6213,8 +6209,8 @@ static int bnx2x_init_common(struct bnx2x *bp) ...@@ -6213,8 +6209,8 @@ static int bnx2x_init_common(struct bnx2x *bp)
if (sizeof(union cdu_context) != 1024) if (sizeof(union cdu_context) != 1024)
/* we currently assume that a context is 1024 bytes */ /* we currently assume that a context is 1024 bytes */
printk(KERN_ALERT PFX "please adjust the size of" pr_alert("please adjust the size of cdu_context(%ld)\n",
" cdu_context(%ld)\n", (long)sizeof(union cdu_context)); (long)sizeof(union cdu_context));
bnx2x_init_block(bp, CDU_BLOCK, COMMON_STAGE); bnx2x_init_block(bp, CDU_BLOCK, COMMON_STAGE);
val = (4 << 24) + (0 << 12) + 1024; val = (4 << 24) + (0 << 12) + 1024;
...@@ -7020,9 +7016,8 @@ static int bnx2x_req_msix_irqs(struct bnx2x *bp) ...@@ -7020,9 +7016,8 @@ static int bnx2x_req_msix_irqs(struct bnx2x *bp)
} }
i = BNX2X_NUM_QUEUES(bp); i = BNX2X_NUM_QUEUES(bp);
printk(KERN_INFO PFX "%s: using MSI-X IRQs: sp %d fp[%d] %d" netdev_info(bp->dev, "using MSI-X IRQs: sp %d fp[%d] %d ... fp[%d] %d\n",
" ... fp[%d] %d\n", bp->msix_table[0].vector,
bp->dev->name, bp->msix_table[0].vector,
0, bp->msix_table[offset].vector, 0, bp->msix_table[offset].vector,
i - 1, bp->msix_table[offset + i - 1].vector); i - 1, bp->msix_table[offset + i - 1].vector);
...@@ -7480,8 +7475,8 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode) ...@@ -7480,8 +7475,8 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
} }
if (bp->flags & USING_MSI_FLAG) { if (bp->flags & USING_MSI_FLAG) {
bp->dev->irq = bp->pdev->irq; bp->dev->irq = bp->pdev->irq;
printk(KERN_INFO PFX "%s: using MSI IRQ %d\n", netdev_info(bp->dev, "using MSI IRQ %d\n",
bp->dev->name, bp->pdev->irq); bp->pdev->irq);
} }
} }
...@@ -8303,8 +8298,7 @@ static void __devinit bnx2x_get_common_hwinfo(struct bnx2x *bp) ...@@ -8303,8 +8298,7 @@ static void __devinit bnx2x_get_common_hwinfo(struct bnx2x *bp)
val3 = SHMEM_RD(bp, dev_info.shared_hw_config.part_num[8]); val3 = SHMEM_RD(bp, dev_info.shared_hw_config.part_num[8]);
val4 = SHMEM_RD(bp, dev_info.shared_hw_config.part_num[12]); val4 = SHMEM_RD(bp, dev_info.shared_hw_config.part_num[12]);
printk(KERN_INFO PFX "part number %X-%X-%X-%X\n", pr_info("part number %X-%X-%X-%X\n", val, val2, val3, val4);
val, val2, val3, val4);
} }
static void __devinit bnx2x_link_settings_supported(struct bnx2x *bp, static void __devinit bnx2x_link_settings_supported(struct bnx2x *bp,
...@@ -8915,17 +8909,15 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp) ...@@ -8915,17 +8909,15 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp)
bnx2x_undi_unload(bp); bnx2x_undi_unload(bp);
if (CHIP_REV_IS_FPGA(bp)) if (CHIP_REV_IS_FPGA(bp))
printk(KERN_ERR PFX "FPGA detected\n"); pr_err("FPGA detected\n");
if (BP_NOMCP(bp) && (func == 0)) if (BP_NOMCP(bp) && (func == 0))
printk(KERN_ERR PFX pr_err("MCP disabled, must load devices in order!\n");
"MCP disabled, must load devices in order!\n");
/* Set multi queue mode */ /* Set multi queue mode */
if ((multi_mode != ETH_RSS_MODE_DISABLED) && if ((multi_mode != ETH_RSS_MODE_DISABLED) &&
((int_mode == INT_MODE_INTx) || (int_mode == INT_MODE_MSI))) { ((int_mode == INT_MODE_INTx) || (int_mode == INT_MODE_MSI))) {
printk(KERN_ERR PFX pr_err("Multi disabled since int_mode requested is not MSI-X\n");
"Multi disabled since int_mode requested is not MSI-X\n");
multi_mode = ETH_RSS_MODE_DISABLED; multi_mode = ETH_RSS_MODE_DISABLED;
} }
bp->multi_mode = multi_mode; bp->multi_mode = multi_mode;
...@@ -9351,7 +9343,7 @@ static u32 bnx2x_get_msglevel(struct net_device *dev) ...@@ -9351,7 +9343,7 @@ static u32 bnx2x_get_msglevel(struct net_device *dev)
{ {
struct bnx2x *bp = netdev_priv(dev); struct bnx2x *bp = netdev_priv(dev);
return bp->msglevel; return bp->msg_enable;
} }
static void bnx2x_set_msglevel(struct net_device *dev, u32 level) static void bnx2x_set_msglevel(struct net_device *dev, u32 level)
...@@ -9359,7 +9351,7 @@ static void bnx2x_set_msglevel(struct net_device *dev, u32 level) ...@@ -9359,7 +9351,7 @@ static void bnx2x_set_msglevel(struct net_device *dev, u32 level)
struct bnx2x *bp = netdev_priv(dev); struct bnx2x *bp = netdev_priv(dev);
if (capable(CAP_NET_ADMIN)) if (capable(CAP_NET_ADMIN))
bp->msglevel = level; bp->msg_enable = level;
} }
static int bnx2x_nway_reset(struct net_device *dev) static int bnx2x_nway_reset(struct net_device *dev)
...@@ -10653,7 +10645,7 @@ static const struct { ...@@ -10653,7 +10645,7 @@ static const struct {
((bnx2x_stats_arr[i].flags & STATS_FLAGS_BOTH) == STATS_FLAGS_PORT) ((bnx2x_stats_arr[i].flags & STATS_FLAGS_BOTH) == STATS_FLAGS_PORT)
#define IS_FUNC_STAT(i) (bnx2x_stats_arr[i].flags & STATS_FLAGS_FUNC) #define IS_FUNC_STAT(i) (bnx2x_stats_arr[i].flags & STATS_FLAGS_FUNC)
#define IS_E1HMF_MODE_STAT(bp) \ #define IS_E1HMF_MODE_STAT(bp) \
(IS_E1HMF(bp) && !(bp->msglevel & BNX2X_MSG_STATS)) (IS_E1HMF(bp) && !(bp->msg_enable & BNX2X_MSG_STATS))
static int bnx2x_get_sset_count(struct net_device *dev, int stringset) static int bnx2x_get_sset_count(struct net_device *dev, int stringset)
{ {
...@@ -11786,20 +11778,18 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev, ...@@ -11786,20 +11778,18 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
rc = pci_enable_device(pdev); rc = pci_enable_device(pdev);
if (rc) { if (rc) {
printk(KERN_ERR PFX "Cannot enable PCI device, aborting\n"); pr_err("Cannot enable PCI device, aborting\n");
goto err_out; goto err_out;
} }
if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) { if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) {
printk(KERN_ERR PFX "Cannot find PCI device base address," pr_err("Cannot find PCI device base address, aborting\n");
" aborting\n");
rc = -ENODEV; rc = -ENODEV;
goto err_out_disable; goto err_out_disable;
} }
if (!(pci_resource_flags(pdev, 2) & IORESOURCE_MEM)) { if (!(pci_resource_flags(pdev, 2) & IORESOURCE_MEM)) {
printk(KERN_ERR PFX "Cannot find second PCI device" pr_err("Cannot find second PCI device base address, aborting\n");
" base address, aborting\n");
rc = -ENODEV; rc = -ENODEV;
goto err_out_disable; goto err_out_disable;
} }
...@@ -11807,8 +11797,7 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev, ...@@ -11807,8 +11797,7 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
if (atomic_read(&pdev->enable_cnt) == 1) { if (atomic_read(&pdev->enable_cnt) == 1) {
rc = pci_request_regions(pdev, DRV_MODULE_NAME); rc = pci_request_regions(pdev, DRV_MODULE_NAME);
if (rc) { if (rc) {
printk(KERN_ERR PFX "Cannot obtain PCI resources," pr_err("Cannot obtain PCI resources, aborting\n");
" aborting\n");
goto err_out_disable; goto err_out_disable;
} }
...@@ -11818,16 +11807,14 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev, ...@@ -11818,16 +11807,14 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
bp->pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM); bp->pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM);
if (bp->pm_cap == 0) { if (bp->pm_cap == 0) {
printk(KERN_ERR PFX "Cannot find power management" pr_err("Cannot find power management capability, aborting\n");
" capability, aborting\n");
rc = -EIO; rc = -EIO;
goto err_out_release; goto err_out_release;
} }
bp->pcie_cap = pci_find_capability(pdev, PCI_CAP_ID_EXP); bp->pcie_cap = pci_find_capability(pdev, PCI_CAP_ID_EXP);
if (bp->pcie_cap == 0) { if (bp->pcie_cap == 0) {
printk(KERN_ERR PFX "Cannot find PCI Express capability," pr_err("Cannot find PCI Express capability, aborting\n");
" aborting\n");
rc = -EIO; rc = -EIO;
goto err_out_release; goto err_out_release;
} }
...@@ -11835,15 +11822,13 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev, ...@@ -11835,15 +11822,13 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) == 0) { if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) == 0) {
bp->flags |= USING_DAC_FLAG; bp->flags |= USING_DAC_FLAG;
if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)) != 0) { if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)) != 0) {
printk(KERN_ERR PFX "pci_set_consistent_dma_mask" pr_err("pci_set_consistent_dma_mask failed, aborting\n");
" failed, aborting\n");
rc = -EIO; rc = -EIO;
goto err_out_release; goto err_out_release;
} }
} else if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0) { } else if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0) {
printk(KERN_ERR PFX "System does not support DMA," pr_err("System does not support DMA, aborting\n");
" aborting\n");
rc = -EIO; rc = -EIO;
goto err_out_release; goto err_out_release;
} }
...@@ -11856,7 +11841,7 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev, ...@@ -11856,7 +11841,7 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
bp->regview = pci_ioremap_bar(pdev, 0); bp->regview = pci_ioremap_bar(pdev, 0);
if (!bp->regview) { if (!bp->regview) {
printk(KERN_ERR PFX "Cannot map register space, aborting\n"); pr_err("Cannot map register space, aborting\n");
rc = -ENOMEM; rc = -ENOMEM;
goto err_out_release; goto err_out_release;
} }
...@@ -11865,7 +11850,7 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev, ...@@ -11865,7 +11850,7 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
min_t(u64, BNX2X_DB_SIZE, min_t(u64, BNX2X_DB_SIZE,
pci_resource_len(pdev, 2))); pci_resource_len(pdev, 2)));
if (!bp->doorbells) { if (!bp->doorbells) {
printk(KERN_ERR PFX "Cannot map doorbell space, aborting\n"); pr_err("Cannot map doorbell space, aborting\n");
rc = -ENOMEM; rc = -ENOMEM;
goto err_out_unmap; goto err_out_unmap;
} }
...@@ -11967,8 +11952,7 @@ static int __devinit bnx2x_check_firmware(struct bnx2x *bp) ...@@ -11967,8 +11952,7 @@ static int __devinit bnx2x_check_firmware(struct bnx2x *bp)
offset = be32_to_cpu(sections[i].offset); offset = be32_to_cpu(sections[i].offset);
len = be32_to_cpu(sections[i].len); len = be32_to_cpu(sections[i].len);
if (offset + len > firmware->size) { if (offset + len > firmware->size) {
printk(KERN_ERR PFX "Section %d length is out of " pr_err("Section %d length is out of bounds\n", i);
"bounds\n", i);
return -EINVAL; return -EINVAL;
} }
} }
...@@ -11980,8 +11964,7 @@ static int __devinit bnx2x_check_firmware(struct bnx2x *bp) ...@@ -11980,8 +11964,7 @@ static int __devinit bnx2x_check_firmware(struct bnx2x *bp)
for (i = 0; i < be32_to_cpu(fw_hdr->init_ops_offsets.len) / 2; i++) { for (i = 0; i < be32_to_cpu(fw_hdr->init_ops_offsets.len) / 2; i++) {
if (be16_to_cpu(ops_offsets[i]) > num_ops) { if (be16_to_cpu(ops_offsets[i]) > num_ops) {
printk(KERN_ERR PFX "Section offset %d is out of " pr_err("Section offset %d is out of bounds\n", i);
"bounds\n", i);
return -EINVAL; return -EINVAL;
} }
} }
...@@ -11993,8 +11976,7 @@ static int __devinit bnx2x_check_firmware(struct bnx2x *bp) ...@@ -11993,8 +11976,7 @@ static int __devinit bnx2x_check_firmware(struct bnx2x *bp)
(fw_ver[1] != BCM_5710_FW_MINOR_VERSION) || (fw_ver[1] != BCM_5710_FW_MINOR_VERSION) ||
(fw_ver[2] != BCM_5710_FW_REVISION_VERSION) || (fw_ver[2] != BCM_5710_FW_REVISION_VERSION) ||
(fw_ver[3] != BCM_5710_FW_ENGINEERING_VERSION)) { (fw_ver[3] != BCM_5710_FW_ENGINEERING_VERSION)) {
printk(KERN_ERR PFX "Bad FW version:%d.%d.%d.%d." pr_err("Bad FW version:%d.%d.%d.%d. Should be %d.%d.%d.%d\n",
" Should be %d.%d.%d.%d\n",
fw_ver[0], fw_ver[1], fw_ver[2], fw_ver[0], fw_ver[1], fw_ver[2],
fw_ver[3], BCM_5710_FW_MAJOR_VERSION, fw_ver[3], BCM_5710_FW_MAJOR_VERSION,
BCM_5710_FW_MINOR_VERSION, BCM_5710_FW_MINOR_VERSION,
...@@ -12045,17 +12027,16 @@ static inline void be16_to_cpu_n(const u8 *_source, u8 *_target, u32 n) ...@@ -12045,17 +12027,16 @@ static inline void be16_to_cpu_n(const u8 *_source, u8 *_target, u32 n)
} }
#define BNX2X_ALLOC_AND_SET(arr, lbl, func) \ #define BNX2X_ALLOC_AND_SET(arr, lbl, func) \
do { \ do { \
u32 len = be32_to_cpu(fw_hdr->arr.len); \ u32 len = be32_to_cpu(fw_hdr->arr.len); \
bp->arr = kmalloc(len, GFP_KERNEL); \ bp->arr = kmalloc(len, GFP_KERNEL); \
if (!bp->arr) { \ if (!bp->arr) { \
printk(KERN_ERR PFX "Failed to allocate %d bytes " \ pr_err("Failed to allocate %d bytes for "#arr"\n", len); \
"for "#arr"\n", len); \
goto lbl; \ goto lbl; \
} \ } \
func(bp->firmware->data + be32_to_cpu(fw_hdr->arr.offset), \ func(bp->firmware->data + be32_to_cpu(fw_hdr->arr.offset), \
(u8 *)bp->arr, len); \ (u8 *)bp->arr, len); \
} while (0) } while (0)
static int __devinit bnx2x_init_firmware(struct bnx2x *bp, struct device *dev) static int __devinit bnx2x_init_firmware(struct bnx2x *bp, struct device *dev)
{ {
...@@ -12068,18 +12049,17 @@ static int __devinit bnx2x_init_firmware(struct bnx2x *bp, struct device *dev) ...@@ -12068,18 +12049,17 @@ static int __devinit bnx2x_init_firmware(struct bnx2x *bp, struct device *dev)
else else
fw_file_name = FW_FILE_NAME_E1H; fw_file_name = FW_FILE_NAME_E1H;
printk(KERN_INFO PFX "Loading %s\n", fw_file_name); pr_info("Loading %s\n", fw_file_name);
rc = request_firmware(&bp->firmware, fw_file_name, dev); rc = request_firmware(&bp->firmware, fw_file_name, dev);
if (rc) { if (rc) {
printk(KERN_ERR PFX "Can't load firmware file %s\n", pr_err("Can't load firmware file %s\n", fw_file_name);
fw_file_name);
goto request_firmware_exit; goto request_firmware_exit;
} }
rc = bnx2x_check_firmware(bp); rc = bnx2x_check_firmware(bp);
if (rc) { if (rc) {
printk(KERN_ERR PFX "Corrupt firmware file %s\n", fw_file_name); pr_err("Corrupt firmware file %s\n", fw_file_name);
goto request_firmware_exit; goto request_firmware_exit;
} }
...@@ -12138,12 +12118,12 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev, ...@@ -12138,12 +12118,12 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
/* dev zeroed in init_etherdev */ /* dev zeroed in init_etherdev */
dev = alloc_etherdev_mq(sizeof(*bp), MAX_CONTEXT); dev = alloc_etherdev_mq(sizeof(*bp), MAX_CONTEXT);
if (!dev) { if (!dev) {
printk(KERN_ERR PFX "Cannot allocate net device\n"); pr_err("Cannot allocate net device\n");
return -ENOMEM; return -ENOMEM;
} }
bp = netdev_priv(dev); bp = netdev_priv(dev);
bp->msglevel = debug; bp->msg_enable = debug;
pci_set_drvdata(pdev, dev); pci_set_drvdata(pdev, dev);
...@@ -12160,7 +12140,7 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev, ...@@ -12160,7 +12140,7 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
/* Set init arrays */ /* Set init arrays */
rc = bnx2x_init_firmware(bp, &pdev->dev); rc = bnx2x_init_firmware(bp, &pdev->dev);
if (rc) { if (rc) {
printk(KERN_ERR PFX "Error loading firmware\n"); pr_err("Error loading firmware\n");
goto init_one_exit; goto init_one_exit;
} }
...@@ -12171,12 +12151,11 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev, ...@@ -12171,12 +12151,11 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
} }
bnx2x_get_pcie_width_speed(bp, &pcie_width, &pcie_speed); bnx2x_get_pcie_width_speed(bp, &pcie_width, &pcie_speed);
printk(KERN_INFO "%s: %s (%c%d) PCI-E x%d %s found at mem %lx," netdev_info(dev, "%s (%c%d) PCI-E x%d %s found at mem %lx, IRQ %d, node addr %pM\n",
" IRQ %d, ", dev->name, board_info[ent->driver_data].name, board_info[ent->driver_data].name,
(CHIP_REV(bp) >> 12) + 'A', (CHIP_METAL(bp) >> 4), (CHIP_REV(bp) >> 12) + 'A', (CHIP_METAL(bp) >> 4),
pcie_width, (pcie_speed == 2) ? "5GHz (Gen2)" : "2.5GHz", pcie_width, (pcie_speed == 2) ? "5GHz (Gen2)" : "2.5GHz",
dev->base_addr, bp->pdev->irq); dev->base_addr, bp->pdev->irq, dev->dev_addr);
printk(KERN_CONT "node addr %pM\n", dev->dev_addr);
return 0; return 0;
...@@ -12204,7 +12183,7 @@ static void __devexit bnx2x_remove_one(struct pci_dev *pdev) ...@@ -12204,7 +12183,7 @@ static void __devexit bnx2x_remove_one(struct pci_dev *pdev)
struct bnx2x *bp; struct bnx2x *bp;
if (!dev) { if (!dev) {
printk(KERN_ERR PFX "BAD net device from bnx2x_init_one\n"); pr_err("BAD net device from bnx2x_init_one\n");
return; return;
} }
bp = netdev_priv(dev); bp = netdev_priv(dev);
...@@ -12237,7 +12216,7 @@ static int bnx2x_suspend(struct pci_dev *pdev, pm_message_t state) ...@@ -12237,7 +12216,7 @@ static int bnx2x_suspend(struct pci_dev *pdev, pm_message_t state)
struct bnx2x *bp; struct bnx2x *bp;
if (!dev) { if (!dev) {
printk(KERN_ERR PFX "BAD net device from bnx2x_init_one\n"); pr_err("BAD net device from bnx2x_init_one\n");
return -ENODEV; return -ENODEV;
} }
bp = netdev_priv(dev); bp = netdev_priv(dev);
...@@ -12269,7 +12248,7 @@ static int bnx2x_resume(struct pci_dev *pdev) ...@@ -12269,7 +12248,7 @@ static int bnx2x_resume(struct pci_dev *pdev)
int rc; int rc;
if (!dev) { if (!dev) {
printk(KERN_ERR PFX "BAD net device from bnx2x_init_one\n"); pr_err("BAD net device from bnx2x_init_one\n");
return -ENODEV; return -ENODEV;
} }
bp = netdev_priv(dev); bp = netdev_priv(dev);
...@@ -12472,17 +12451,17 @@ static int __init bnx2x_init(void) ...@@ -12472,17 +12451,17 @@ static int __init bnx2x_init(void)
{ {
int ret; int ret;
printk(KERN_INFO "%s", version); pr_info("%s", version);
bnx2x_wq = create_singlethread_workqueue("bnx2x"); bnx2x_wq = create_singlethread_workqueue("bnx2x");
if (bnx2x_wq == NULL) { if (bnx2x_wq == NULL) {
printk(KERN_ERR PFX "Cannot create workqueue\n"); pr_err("Cannot create workqueue\n");
return -ENOMEM; return -ENOMEM;
} }
ret = pci_register_driver(&bnx2x_pci_driver); ret = pci_register_driver(&bnx2x_pci_driver);
if (ret) { if (ret) {
printk(KERN_ERR PFX "Cannot register driver\n"); pr_err("Cannot register driver\n");
destroy_workqueue(bnx2x_wq); destroy_workqueue(bnx2x_wq);
} }
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment