aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2010-02-17 10:01:52 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-17 20:45:20 -0500
commit7995c64e5b56ec7fe6032e5fc586f726cde2152b (patch)
treeb072d2e42f717d8f2c3d94e9431c48a3e8304f72 /drivers
parent3a9c6a4915e584663aebdb9016bcb9d3897dd779 (diff)
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: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/bnx2x.h49
-rw-r--r--drivers/net/bnx2x_link.c21
-rw-r--r--drivers/net/bnx2x_main.c185
3 files changed, 117 insertions, 138 deletions
diff --git a/drivers/net/bnx2x.h b/drivers/net/bnx2x.h
index d997d8472ee5..3c48a7a68308 100644
--- a/drivers/net/bnx2x.h
+++ b/drivers/net/bnx2x.h
@@ -44,7 +44,6 @@
44/* error/debug prints */ 44/* error/debug prints */
45 45
46#define DRV_MODULE_NAME "bnx2x" 46#define DRV_MODULE_NAME "bnx2x"
47#define PFX DRV_MODULE_NAME ": "
48 47
49/* for messages that are currently off */ 48/* for messages that are currently off */
50#define BNX2X_MSG_OFF 0 49#define BNX2X_MSG_OFF 0
@@ -58,30 +57,40 @@
58#define DP_LEVEL KERN_NOTICE /* was: KERN_DEBUG */ 57#define DP_LEVEL KERN_NOTICE /* was: KERN_DEBUG */
59 58
60/* regular debug print */ 59/* regular debug print */
61#define DP(__mask, __fmt, __args...) do { \ 60#define DP(__mask, __fmt, __args...) \
62 if (bp->msglevel & (__mask)) \ 61do { \
63 printk(DP_LEVEL "[%s:%d(%s)]" __fmt, __func__, __LINE__, \ 62 if (bp->msg_enable & (__mask)) \
64 bp->dev ? (bp->dev->name) : "?", ##__args); \ 63 printk(DP_LEVEL "[%s:%d(%s)]" __fmt, \
65 } while (0) 64 __func__, __LINE__, \
65 bp->dev ? (bp->dev->name) : "?", \
66 ##__args); \
67} while (0)
66 68
67/* errors debug print */ 69/* errors debug print */
68#define BNX2X_DBG_ERR(__fmt, __args...) do { \ 70#define BNX2X_DBG_ERR(__fmt, __args...) \
69 if (bp->msglevel & NETIF_MSG_PROBE) \ 71do { \
70 printk(KERN_ERR "[%s:%d(%s)]" __fmt, __func__, __LINE__, \ 72 if (netif_msg_probe(bp)) \
71 bp->dev ? (bp->dev->name) : "?", ##__args); \ 73 pr_err("[%s:%d(%s)]" __fmt, \
72 } while (0) 74 __func__, __LINE__, \
75 bp->dev ? (bp->dev->name) : "?", \
76 ##__args); \
77} while (0)
73 78
74/* for errors (never masked) */ 79/* for errors (never masked) */
75#define BNX2X_ERR(__fmt, __args...) do { \ 80#define BNX2X_ERR(__fmt, __args...) \
76 printk(KERN_ERR "[%s:%d(%s)]" __fmt, __func__, __LINE__, \ 81do { \
77 bp->dev ? (bp->dev->name) : "?", ##__args); \ 82 pr_err("[%s:%d(%s)]" __fmt, \
78 } while (0) 83 __func__, __LINE__, \
84 bp->dev ? (bp->dev->name) : "?", \
85 ##__args); \
86} while (0)
79 87
80/* before we have a dev->name use dev_info() */ 88/* before we have a dev->name use dev_info() */
81#define BNX2X_DEV_INFO(__fmt, __args...) do { \ 89#define BNX2X_DEV_INFO(__fmt, __args...) \
82 if (bp->msglevel & NETIF_MSG_PROBE) \ 90do { \
83 dev_info(&bp->pdev->dev, __fmt, ##__args); \ 91 if (netif_msg_probe(bp)) \
84 } while (0) 92 dev_info(&bp->pdev->dev, __fmt, ##__args); \
93} while (0)
85 94
86 95
87#ifdef BNX2X_STOP_ON_ERROR 96#ifdef BNX2X_STOP_ON_ERROR
@@ -882,7 +891,7 @@ struct bnx2x {
882 /* End of fields used in the performance code paths */ 891 /* End of fields used in the performance code paths */
883 892
884 int panic; 893 int panic;
885 int msglevel; 894 int msg_enable;
886 895
887 u32 flags; 896 u32 flags;
888#define PCIX_FLAG 1 897#define PCIX_FLAG 1
diff --git a/drivers/net/bnx2x_link.c b/drivers/net/bnx2x_link.c
index cf5778919b4b..32e79c359e89 100644
--- a/drivers/net/bnx2x_link.c
+++ b/drivers/net/bnx2x_link.c
@@ -14,6 +14,8 @@
14 * 14 *
15 */ 15 */
16 16
17#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
18
17#include <linux/kernel.h> 19#include <linux/kernel.h>
18#include <linux/errno.h> 20#include <linux/errno.h>
19#include <linux/pci.h> 21#include <linux/pci.h>
@@ -2987,11 +2989,8 @@ static u8 bnx2x_verify_sfp_module(struct link_params *params)
2987 else 2989 else
2988 vendor_pn[SFP_EEPROM_PART_NO_SIZE] = '\0'; 2990 vendor_pn[SFP_EEPROM_PART_NO_SIZE] = '\0';
2989 2991
2990 printk(KERN_INFO PFX "Warning: " 2992 netdev_info(bp->dev, "Warning: Unqualified SFP+ module detected, Port %d from %s part number %s\n",
2991 "Unqualified SFP+ module " 2993 params->port, vendor_name, vendor_pn);
2992 "detected on %s, Port %d from %s part number %s\n"
2993 , bp->dev->name, params->port,
2994 vendor_name, vendor_pn);
2995 return -EINVAL; 2994 return -EINVAL;
2996} 2995}
2997 2996
@@ -4846,16 +4845,8 @@ static u8 bnx2x_ext_phy_is_link_up(struct link_params *params,
4846 " has been detected on " 4845 " has been detected on "
4847 "port %d\n", 4846 "port %d\n",
4848 params->port); 4847 params->port);
4849 printk(KERN_ERR PFX "Error: Power" 4848 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",
4850 " fault on %s Port %d has" 4849 params->port);
4851 " been detected and the"
4852 " power to that SFP+ module"
4853 " has been removed to prevent"
4854 " failure of the card. Please"
4855 " remove the SFP+ module and"
4856 " restart the system to clear"
4857 " this error.\n"
4858 , bp->dev->name, params->port);
4859 /* 4850 /*
4860 * Disable all RX_ALARMs except for 4851 * Disable all RX_ALARMs except for
4861 * mod_abs 4852 * mod_abs
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
index a4e8460ff656..7f9db47e8cc3 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -514,24 +514,24 @@ static void bnx2x_fw_dump(struct bnx2x *bp)
514 514
515 mark = REG_RD(bp, MCP_REG_MCPR_SCRATCH + 0xf104); 515 mark = REG_RD(bp, MCP_REG_MCPR_SCRATCH + 0xf104);
516 mark = ((mark + 0x3) & ~0x3); 516 mark = ((mark + 0x3) & ~0x3);
517 printk(KERN_ERR PFX "begin fw dump (mark 0x%x)\n", mark); 517 pr_err("begin fw dump (mark 0x%x)\n", mark);
518 518
519 printk(KERN_ERR PFX); 519 pr_err("");
520 for (offset = mark - 0x08000000; offset <= 0xF900; offset += 0x8*4) { 520 for (offset = mark - 0x08000000; offset <= 0xF900; offset += 0x8*4) {
521 for (word = 0; word < 8; word++) 521 for (word = 0; word < 8; word++)
522 data[word] = htonl(REG_RD(bp, MCP_REG_MCPR_SCRATCH + 522 data[word] = htonl(REG_RD(bp, MCP_REG_MCPR_SCRATCH +
523 offset + 4*word)); 523 offset + 4*word));
524 data[8] = 0x0; 524 data[8] = 0x0;
525 printk(KERN_CONT "%s", (char *)data); 525 pr_cont("%s", (char *)data);
526 } 526 }
527 for (offset = 0xF108; offset <= mark - 0x08000000; offset += 0x8*4) { 527 for (offset = 0xF108; offset <= mark - 0x08000000; offset += 0x8*4) {
528 for (word = 0; word < 8; word++) 528 for (word = 0; word < 8; word++)
529 data[word] = htonl(REG_RD(bp, MCP_REG_MCPR_SCRATCH + 529 data[word] = htonl(REG_RD(bp, MCP_REG_MCPR_SCRATCH +
530 offset + 4*word)); 530 offset + 4*word));
531 data[8] = 0x0; 531 data[8] = 0x0;
532 printk(KERN_CONT "%s", (char *)data); 532 pr_cont("%s", (char *)data);
533 } 533 }
534 printk(KERN_ERR PFX "end of fw dump\n"); 534 pr_err("end of fw dump\n");
535} 535}
536 536
537static void bnx2x_panic_dump(struct bnx2x *bp) 537static void bnx2x_panic_dump(struct bnx2x *bp)
@@ -2136,7 +2136,7 @@ static void bnx2x_link_report(struct bnx2x *bp)
2136{ 2136{
2137 if (bp->flags & MF_FUNC_DIS) { 2137 if (bp->flags & MF_FUNC_DIS) {
2138 netif_carrier_off(bp->dev); 2138 netif_carrier_off(bp->dev);
2139 printk(KERN_ERR PFX "%s NIC Link is Down\n", bp->dev->name); 2139 netdev_err(bp->dev, "NIC Link is Down\n");
2140 return; 2140 return;
2141 } 2141 }
2142 2142
@@ -2145,7 +2145,7 @@ static void bnx2x_link_report(struct bnx2x *bp)
2145 2145
2146 if (bp->state == BNX2X_STATE_OPEN) 2146 if (bp->state == BNX2X_STATE_OPEN)
2147 netif_carrier_on(bp->dev); 2147 netif_carrier_on(bp->dev);
2148 printk(KERN_INFO PFX "%s NIC Link is Up, ", bp->dev->name); 2148 netdev_info(bp->dev, "NIC Link is Up, ");
2149 2149
2150 line_speed = bp->link_vars.line_speed; 2150 line_speed = bp->link_vars.line_speed;
2151 if (IS_E1HMF(bp)) { 2151 if (IS_E1HMF(bp)) {
@@ -2157,29 +2157,29 @@ static void bnx2x_link_report(struct bnx2x *bp)
2157 if (vn_max_rate < line_speed) 2157 if (vn_max_rate < line_speed)
2158 line_speed = vn_max_rate; 2158 line_speed = vn_max_rate;
2159 } 2159 }
2160 printk("%d Mbps ", line_speed); 2160 pr_cont("%d Mbps ", line_speed);
2161 2161
2162 if (bp->link_vars.duplex == DUPLEX_FULL) 2162 if (bp->link_vars.duplex == DUPLEX_FULL)
2163 printk("full duplex"); 2163 pr_cont("full duplex");
2164 else 2164 else
2165 printk("half duplex"); 2165 pr_cont("half duplex");
2166 2166
2167 if (bp->link_vars.flow_ctrl != BNX2X_FLOW_CTRL_NONE) { 2167 if (bp->link_vars.flow_ctrl != BNX2X_FLOW_CTRL_NONE) {
2168 if (bp->link_vars.flow_ctrl & BNX2X_FLOW_CTRL_RX) { 2168 if (bp->link_vars.flow_ctrl & BNX2X_FLOW_CTRL_RX) {
2169 printk(", receive "); 2169 pr_cont(", receive ");
2170 if (bp->link_vars.flow_ctrl & 2170 if (bp->link_vars.flow_ctrl &
2171 BNX2X_FLOW_CTRL_TX) 2171 BNX2X_FLOW_CTRL_TX)
2172 printk("& transmit "); 2172 pr_cont("& transmit ");
2173 } else { 2173 } else {
2174 printk(", transmit "); 2174 pr_cont(", transmit ");
2175 } 2175 }
2176 printk("flow control ON"); 2176 pr_cont("flow control ON");
2177 } 2177 }
2178 printk("\n"); 2178 pr_cont("\n");
2179 2179
2180 } else { /* link_down */ 2180 } else { /* link_down */
2181 netif_carrier_off(bp->dev); 2181 netif_carrier_off(bp->dev);
2182 printk(KERN_ERR PFX "%s NIC Link is Down\n", bp->dev->name); 2182 netdev_err(bp->dev, "NIC Link is Down\n");
2183 } 2183 }
2184} 2184}
2185 2185
@@ -2898,10 +2898,8 @@ static inline void bnx2x_fan_failure(struct bnx2x *bp)
2898 bp->link_params.ext_phy_config); 2898 bp->link_params.ext_phy_config);
2899 2899
2900 /* log the failure */ 2900 /* log the failure */
2901 printk(KERN_ERR PFX "Fan Failure on Network Controller %s has caused" 2901 netdev_err(bp->dev, "Fan Failure on Network Controller has caused the driver to shutdown the card to prevent permanent damage.\n"
2902 " the driver to shutdown the card to prevent permanent" 2902 "Please contact Dell Support for assistance.\n");
2903 " damage. Please contact Dell Support for assistance\n",
2904 bp->dev->name);
2905} 2903}
2906 2904
2907static inline void bnx2x_attn_int_deasserted0(struct bnx2x *bp, u32 attn) 2905static inline void bnx2x_attn_int_deasserted0(struct bnx2x *bp, u32 attn)
@@ -4296,7 +4294,7 @@ static void bnx2x_stats_update(struct bnx2x *bp)
4296 bnx2x_net_stats_update(bp); 4294 bnx2x_net_stats_update(bp);
4297 bnx2x_drv_stats_update(bp); 4295 bnx2x_drv_stats_update(bp);
4298 4296
4299 if (bp->msglevel & NETIF_MSG_TIMER) { 4297 if (netif_msg_timer(bp)) {
4300 struct bnx2x_fastpath *fp0_rx = bp->fp; 4298 struct bnx2x_fastpath *fp0_rx = bp->fp;
4301 struct bnx2x_fastpath *fp0_tx = bp->fp; 4299 struct bnx2x_fastpath *fp0_tx = bp->fp;
4302 struct tstorm_per_client_stats *old_tclient = 4300 struct tstorm_per_client_stats *old_tclient =
@@ -4306,7 +4304,7 @@ static void bnx2x_stats_update(struct bnx2x *bp)
4306 struct net_device_stats *nstats = &bp->dev->stats; 4304 struct net_device_stats *nstats = &bp->dev->stats;
4307 int i; 4305 int i;
4308 4306
4309 printk(KERN_DEBUG "%s:\n", bp->dev->name); 4307 netdev_printk(KERN_DEBUG, bp->dev, "\n");
4310 printk(KERN_DEBUG " tx avail (%4x) tx hc idx (%x)" 4308 printk(KERN_DEBUG " tx avail (%4x) tx hc idx (%x)"
4311 " tx pkt (%lx)\n", 4309 " tx pkt (%lx)\n",
4312 bnx2x_tx_avail(fp0_tx), 4310 bnx2x_tx_avail(fp0_tx),
@@ -4464,7 +4462,7 @@ static void bnx2x_stats_handle(struct bnx2x *bp, enum bnx2x_stats_event event)
4464 /* Make sure the state has been "changed" */ 4462 /* Make sure the state has been "changed" */
4465 smp_wmb(); 4463 smp_wmb();
4466 4464
4467 if ((event != STATS_EVENT_UPDATE) || (bp->msglevel & NETIF_MSG_TIMER)) 4465 if ((event != STATS_EVENT_UPDATE) || netif_msg_timer(bp))
4468 DP(BNX2X_MSG_STATS, "state %d -> event %d -> state %d\n", 4466 DP(BNX2X_MSG_STATS, "state %d -> event %d -> state %d\n",
4469 state, event, bp->stats_state); 4467 state, event, bp->stats_state);
4470} 4468}
@@ -5674,8 +5672,7 @@ gunzip_nomem2:
5674 bp->gunzip_buf = NULL; 5672 bp->gunzip_buf = NULL;
5675 5673
5676gunzip_nomem1: 5674gunzip_nomem1:
5677 printk(KERN_ERR PFX "%s: Cannot allocate firmware buffer for" 5675 netdev_err(bp->dev, "Cannot allocate firmware buffer for un-compression\n");
5678 " un-compression\n", bp->dev->name);
5679 return -ENOMEM; 5676 return -ENOMEM;
5680} 5677}
5681 5678
@@ -5721,14 +5718,13 @@ static int bnx2x_gunzip(struct bnx2x *bp, const u8 *zbuf, int len)
5721 5718
5722 rc = zlib_inflate(bp->strm, Z_FINISH); 5719 rc = zlib_inflate(bp->strm, Z_FINISH);
5723 if ((rc != Z_OK) && (rc != Z_STREAM_END)) 5720 if ((rc != Z_OK) && (rc != Z_STREAM_END))
5724 printk(KERN_ERR PFX "%s: Firmware decompression error: %s\n", 5721 netdev_err(bp->dev, "Firmware decompression error: %s\n",
5725 bp->dev->name, bp->strm->msg); 5722 bp->strm->msg);
5726 5723
5727 bp->gunzip_outlen = (FW_BUF_SIZE - bp->strm->avail_out); 5724 bp->gunzip_outlen = (FW_BUF_SIZE - bp->strm->avail_out);
5728 if (bp->gunzip_outlen & 0x3) 5725 if (bp->gunzip_outlen & 0x3)
5729 printk(KERN_ERR PFX "%s: Firmware decompression error:" 5726 netdev_err(bp->dev, "Firmware decompression error: gunzip_outlen (%d) not aligned\n",
5730 " gunzip_outlen (%d) not aligned\n", 5727 bp->gunzip_outlen);
5731 bp->dev->name, bp->gunzip_outlen);
5732 bp->gunzip_outlen >>= 2; 5728 bp->gunzip_outlen >>= 2;
5733 5729
5734 zlib_inflateEnd(bp->strm); 5730 zlib_inflateEnd(bp->strm);
@@ -6213,8 +6209,8 @@ static int bnx2x_init_common(struct bnx2x *bp)
6213 6209
6214 if (sizeof(union cdu_context) != 1024) 6210 if (sizeof(union cdu_context) != 1024)
6215 /* we currently assume that a context is 1024 bytes */ 6211 /* we currently assume that a context is 1024 bytes */
6216 printk(KERN_ALERT PFX "please adjust the size of" 6212 pr_alert("please adjust the size of cdu_context(%ld)\n",
6217 " cdu_context(%ld)\n", (long)sizeof(union cdu_context)); 6213 (long)sizeof(union cdu_context));
6218 6214
6219 bnx2x_init_block(bp, CDU_BLOCK, COMMON_STAGE); 6215 bnx2x_init_block(bp, CDU_BLOCK, COMMON_STAGE);
6220 val = (4 << 24) + (0 << 12) + 1024; 6216 val = (4 << 24) + (0 << 12) + 1024;
@@ -7020,11 +7016,10 @@ static int bnx2x_req_msix_irqs(struct bnx2x *bp)
7020 } 7016 }
7021 7017
7022 i = BNX2X_NUM_QUEUES(bp); 7018 i = BNX2X_NUM_QUEUES(bp);
7023 printk(KERN_INFO PFX "%s: using MSI-X IRQs: sp %d fp[%d] %d" 7019 netdev_info(bp->dev, "using MSI-X IRQs: sp %d fp[%d] %d ... fp[%d] %d\n",
7024 " ... fp[%d] %d\n", 7020 bp->msix_table[0].vector,
7025 bp->dev->name, bp->msix_table[0].vector, 7021 0, bp->msix_table[offset].vector,
7026 0, bp->msix_table[offset].vector, 7022 i - 1, bp->msix_table[offset + i - 1].vector);
7027 i - 1, bp->msix_table[offset + i - 1].vector);
7028 7023
7029 return 0; 7024 return 0;
7030} 7025}
@@ -7480,8 +7475,8 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
7480 } 7475 }
7481 if (bp->flags & USING_MSI_FLAG) { 7476 if (bp->flags & USING_MSI_FLAG) {
7482 bp->dev->irq = bp->pdev->irq; 7477 bp->dev->irq = bp->pdev->irq;
7483 printk(KERN_INFO PFX "%s: using MSI IRQ %d\n", 7478 netdev_info(bp->dev, "using MSI IRQ %d\n",
7484 bp->dev->name, bp->pdev->irq); 7479 bp->pdev->irq);
7485 } 7480 }
7486 } 7481 }
7487 7482
@@ -8303,8 +8298,7 @@ static void __devinit bnx2x_get_common_hwinfo(struct bnx2x *bp)
8303 val3 = SHMEM_RD(bp, dev_info.shared_hw_config.part_num[8]); 8298 val3 = SHMEM_RD(bp, dev_info.shared_hw_config.part_num[8]);
8304 val4 = SHMEM_RD(bp, dev_info.shared_hw_config.part_num[12]); 8299 val4 = SHMEM_RD(bp, dev_info.shared_hw_config.part_num[12]);
8305 8300
8306 printk(KERN_INFO PFX "part number %X-%X-%X-%X\n", 8301 pr_info("part number %X-%X-%X-%X\n", val, val2, val3, val4);
8307 val, val2, val3, val4);
8308} 8302}
8309 8303
8310static void __devinit bnx2x_link_settings_supported(struct bnx2x *bp, 8304static void __devinit bnx2x_link_settings_supported(struct bnx2x *bp,
@@ -8915,17 +8909,15 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp)
8915 bnx2x_undi_unload(bp); 8909 bnx2x_undi_unload(bp);
8916 8910
8917 if (CHIP_REV_IS_FPGA(bp)) 8911 if (CHIP_REV_IS_FPGA(bp))
8918 printk(KERN_ERR PFX "FPGA detected\n"); 8912 pr_err("FPGA detected\n");
8919 8913
8920 if (BP_NOMCP(bp) && (func == 0)) 8914 if (BP_NOMCP(bp) && (func == 0))
8921 printk(KERN_ERR PFX 8915 pr_err("MCP disabled, must load devices in order!\n");
8922 "MCP disabled, must load devices in order!\n");
8923 8916
8924 /* Set multi queue mode */ 8917 /* Set multi queue mode */
8925 if ((multi_mode != ETH_RSS_MODE_DISABLED) && 8918 if ((multi_mode != ETH_RSS_MODE_DISABLED) &&
8926 ((int_mode == INT_MODE_INTx) || (int_mode == INT_MODE_MSI))) { 8919 ((int_mode == INT_MODE_INTx) || (int_mode == INT_MODE_MSI))) {
8927 printk(KERN_ERR PFX 8920 pr_err("Multi disabled since int_mode requested is not MSI-X\n");
8928 "Multi disabled since int_mode requested is not MSI-X\n");
8929 multi_mode = ETH_RSS_MODE_DISABLED; 8921 multi_mode = ETH_RSS_MODE_DISABLED;
8930 } 8922 }
8931 bp->multi_mode = multi_mode; 8923 bp->multi_mode = multi_mode;
@@ -9351,7 +9343,7 @@ static u32 bnx2x_get_msglevel(struct net_device *dev)
9351{ 9343{
9352 struct bnx2x *bp = netdev_priv(dev); 9344 struct bnx2x *bp = netdev_priv(dev);
9353 9345
9354 return bp->msglevel; 9346 return bp->msg_enable;
9355} 9347}
9356 9348
9357static void bnx2x_set_msglevel(struct net_device *dev, u32 level) 9349static 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 struct bnx2x *bp = netdev_priv(dev); 9351 struct bnx2x *bp = netdev_priv(dev);
9360 9352
9361 if (capable(CAP_NET_ADMIN)) 9353 if (capable(CAP_NET_ADMIN))
9362 bp->msglevel = level; 9354 bp->msg_enable = level;
9363} 9355}
9364 9356
9365static int bnx2x_nway_reset(struct net_device *dev) 9357static int bnx2x_nway_reset(struct net_device *dev)
@@ -10653,7 +10645,7 @@ static const struct {
10653 ((bnx2x_stats_arr[i].flags & STATS_FLAGS_BOTH) == STATS_FLAGS_PORT) 10645 ((bnx2x_stats_arr[i].flags & STATS_FLAGS_BOTH) == STATS_FLAGS_PORT)
10654#define IS_FUNC_STAT(i) (bnx2x_stats_arr[i].flags & STATS_FLAGS_FUNC) 10646#define IS_FUNC_STAT(i) (bnx2x_stats_arr[i].flags & STATS_FLAGS_FUNC)
10655#define IS_E1HMF_MODE_STAT(bp) \ 10647#define IS_E1HMF_MODE_STAT(bp) \
10656 (IS_E1HMF(bp) && !(bp->msglevel & BNX2X_MSG_STATS)) 10648 (IS_E1HMF(bp) && !(bp->msg_enable & BNX2X_MSG_STATS))
10657 10649
10658static int bnx2x_get_sset_count(struct net_device *dev, int stringset) 10650static int bnx2x_get_sset_count(struct net_device *dev, int stringset)
10659{ 10651{
@@ -11786,20 +11778,18 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
11786 11778
11787 rc = pci_enable_device(pdev); 11779 rc = pci_enable_device(pdev);
11788 if (rc) { 11780 if (rc) {
11789 printk(KERN_ERR PFX "Cannot enable PCI device, aborting\n"); 11781 pr_err("Cannot enable PCI device, aborting\n");
11790 goto err_out; 11782 goto err_out;
11791 } 11783 }
11792 11784
11793 if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) { 11785 if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) {
11794 printk(KERN_ERR PFX "Cannot find PCI device base address," 11786 pr_err("Cannot find PCI device base address, aborting\n");
11795 " aborting\n");
11796 rc = -ENODEV; 11787 rc = -ENODEV;
11797 goto err_out_disable; 11788 goto err_out_disable;
11798 } 11789 }
11799 11790
11800 if (!(pci_resource_flags(pdev, 2) & IORESOURCE_MEM)) { 11791 if (!(pci_resource_flags(pdev, 2) & IORESOURCE_MEM)) {
11801 printk(KERN_ERR PFX "Cannot find second PCI device" 11792 pr_err("Cannot find second PCI device base address, aborting\n");
11802 " base address, aborting\n");
11803 rc = -ENODEV; 11793 rc = -ENODEV;
11804 goto err_out_disable; 11794 goto err_out_disable;
11805 } 11795 }
@@ -11807,8 +11797,7 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
11807 if (atomic_read(&pdev->enable_cnt) == 1) { 11797 if (atomic_read(&pdev->enable_cnt) == 1) {
11808 rc = pci_request_regions(pdev, DRV_MODULE_NAME); 11798 rc = pci_request_regions(pdev, DRV_MODULE_NAME);
11809 if (rc) { 11799 if (rc) {
11810 printk(KERN_ERR PFX "Cannot obtain PCI resources," 11800 pr_err("Cannot obtain PCI resources, aborting\n");
11811 " aborting\n");
11812 goto err_out_disable; 11801 goto err_out_disable;
11813 } 11802 }
11814 11803
@@ -11818,16 +11807,14 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
11818 11807
11819 bp->pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM); 11808 bp->pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM);
11820 if (bp->pm_cap == 0) { 11809 if (bp->pm_cap == 0) {
11821 printk(KERN_ERR PFX "Cannot find power management" 11810 pr_err("Cannot find power management capability, aborting\n");
11822 " capability, aborting\n");
11823 rc = -EIO; 11811 rc = -EIO;
11824 goto err_out_release; 11812 goto err_out_release;
11825 } 11813 }
11826 11814
11827 bp->pcie_cap = pci_find_capability(pdev, PCI_CAP_ID_EXP); 11815 bp->pcie_cap = pci_find_capability(pdev, PCI_CAP_ID_EXP);
11828 if (bp->pcie_cap == 0) { 11816 if (bp->pcie_cap == 0) {
11829 printk(KERN_ERR PFX "Cannot find PCI Express capability," 11817 pr_err("Cannot find PCI Express capability, aborting\n");
11830 " aborting\n");
11831 rc = -EIO; 11818 rc = -EIO;
11832 goto err_out_release; 11819 goto err_out_release;
11833 } 11820 }
@@ -11835,15 +11822,13 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
11835 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) == 0) { 11822 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) == 0) {
11836 bp->flags |= USING_DAC_FLAG; 11823 bp->flags |= USING_DAC_FLAG;
11837 if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)) != 0) { 11824 if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)) != 0) {
11838 printk(KERN_ERR PFX "pci_set_consistent_dma_mask" 11825 pr_err("pci_set_consistent_dma_mask failed, aborting\n");
11839 " failed, aborting\n");
11840 rc = -EIO; 11826 rc = -EIO;
11841 goto err_out_release; 11827 goto err_out_release;
11842 } 11828 }
11843 11829
11844 } else if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0) { 11830 } else if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0) {
11845 printk(KERN_ERR PFX "System does not support DMA," 11831 pr_err("System does not support DMA, aborting\n");
11846 " aborting\n");
11847 rc = -EIO; 11832 rc = -EIO;
11848 goto err_out_release; 11833 goto err_out_release;
11849 } 11834 }
@@ -11856,7 +11841,7 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
11856 11841
11857 bp->regview = pci_ioremap_bar(pdev, 0); 11842 bp->regview = pci_ioremap_bar(pdev, 0);
11858 if (!bp->regview) { 11843 if (!bp->regview) {
11859 printk(KERN_ERR PFX "Cannot map register space, aborting\n"); 11844 pr_err("Cannot map register space, aborting\n");
11860 rc = -ENOMEM; 11845 rc = -ENOMEM;
11861 goto err_out_release; 11846 goto err_out_release;
11862 } 11847 }
@@ -11865,7 +11850,7 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
11865 min_t(u64, BNX2X_DB_SIZE, 11850 min_t(u64, BNX2X_DB_SIZE,
11866 pci_resource_len(pdev, 2))); 11851 pci_resource_len(pdev, 2)));
11867 if (!bp->doorbells) { 11852 if (!bp->doorbells) {
11868 printk(KERN_ERR PFX "Cannot map doorbell space, aborting\n"); 11853 pr_err("Cannot map doorbell space, aborting\n");
11869 rc = -ENOMEM; 11854 rc = -ENOMEM;
11870 goto err_out_unmap; 11855 goto err_out_unmap;
11871 } 11856 }
@@ -11967,8 +11952,7 @@ static int __devinit bnx2x_check_firmware(struct bnx2x *bp)
11967 offset = be32_to_cpu(sections[i].offset); 11952 offset = be32_to_cpu(sections[i].offset);
11968 len = be32_to_cpu(sections[i].len); 11953 len = be32_to_cpu(sections[i].len);
11969 if (offset + len > firmware->size) { 11954 if (offset + len > firmware->size) {
11970 printk(KERN_ERR PFX "Section %d length is out of " 11955 pr_err("Section %d length is out of bounds\n", i);
11971 "bounds\n", i);
11972 return -EINVAL; 11956 return -EINVAL;
11973 } 11957 }
11974 } 11958 }
@@ -11980,8 +11964,7 @@ static int __devinit bnx2x_check_firmware(struct bnx2x *bp)
11980 11964
11981 for (i = 0; i < be32_to_cpu(fw_hdr->init_ops_offsets.len) / 2; i++) { 11965 for (i = 0; i < be32_to_cpu(fw_hdr->init_ops_offsets.len) / 2; i++) {
11982 if (be16_to_cpu(ops_offsets[i]) > num_ops) { 11966 if (be16_to_cpu(ops_offsets[i]) > num_ops) {
11983 printk(KERN_ERR PFX "Section offset %d is out of " 11967 pr_err("Section offset %d is out of bounds\n", i);
11984 "bounds\n", i);
11985 return -EINVAL; 11968 return -EINVAL;
11986 } 11969 }
11987 } 11970 }
@@ -11993,8 +11976,7 @@ static int __devinit bnx2x_check_firmware(struct bnx2x *bp)
11993 (fw_ver[1] != BCM_5710_FW_MINOR_VERSION) || 11976 (fw_ver[1] != BCM_5710_FW_MINOR_VERSION) ||
11994 (fw_ver[2] != BCM_5710_FW_REVISION_VERSION) || 11977 (fw_ver[2] != BCM_5710_FW_REVISION_VERSION) ||
11995 (fw_ver[3] != BCM_5710_FW_ENGINEERING_VERSION)) { 11978 (fw_ver[3] != BCM_5710_FW_ENGINEERING_VERSION)) {
11996 printk(KERN_ERR PFX "Bad FW version:%d.%d.%d.%d." 11979 pr_err("Bad FW version:%d.%d.%d.%d. Should be %d.%d.%d.%d\n",
11997 " Should be %d.%d.%d.%d\n",
11998 fw_ver[0], fw_ver[1], fw_ver[2], 11980 fw_ver[0], fw_ver[1], fw_ver[2],
11999 fw_ver[3], BCM_5710_FW_MAJOR_VERSION, 11981 fw_ver[3], BCM_5710_FW_MAJOR_VERSION,
12000 BCM_5710_FW_MINOR_VERSION, 11982 BCM_5710_FW_MINOR_VERSION,
@@ -12044,18 +12026,17 @@ static inline void be16_to_cpu_n(const u8 *_source, u8 *_target, u32 n)
12044 target[i] = be16_to_cpu(source[i]); 12026 target[i] = be16_to_cpu(source[i]);
12045} 12027}
12046 12028
12047#define BNX2X_ALLOC_AND_SET(arr, lbl, func) \ 12029#define BNX2X_ALLOC_AND_SET(arr, lbl, func) \
12048 do { \ 12030do { \
12049 u32 len = be32_to_cpu(fw_hdr->arr.len); \ 12031 u32 len = be32_to_cpu(fw_hdr->arr.len); \
12050 bp->arr = kmalloc(len, GFP_KERNEL); \ 12032 bp->arr = kmalloc(len, GFP_KERNEL); \
12051 if (!bp->arr) { \ 12033 if (!bp->arr) { \
12052 printk(KERN_ERR PFX "Failed to allocate %d bytes " \ 12034 pr_err("Failed to allocate %d bytes for "#arr"\n", len); \
12053 "for "#arr"\n", len); \ 12035 goto lbl; \
12054 goto lbl; \ 12036 } \
12055 } \ 12037 func(bp->firmware->data + be32_to_cpu(fw_hdr->arr.offset), \
12056 func(bp->firmware->data + be32_to_cpu(fw_hdr->arr.offset), \ 12038 (u8 *)bp->arr, len); \
12057 (u8 *)bp->arr, len); \ 12039} while (0)
12058 } while (0)
12059 12040
12060static int __devinit bnx2x_init_firmware(struct bnx2x *bp, struct device *dev) 12041static int __devinit bnx2x_init_firmware(struct bnx2x *bp, struct device *dev)
12061{ 12042{
@@ -12068,18 +12049,17 @@ static int __devinit bnx2x_init_firmware(struct bnx2x *bp, struct device *dev)
12068 else 12049 else
12069 fw_file_name = FW_FILE_NAME_E1H; 12050 fw_file_name = FW_FILE_NAME_E1H;
12070 12051
12071 printk(KERN_INFO PFX "Loading %s\n", fw_file_name); 12052 pr_info("Loading %s\n", fw_file_name);
12072 12053
12073 rc = request_firmware(&bp->firmware, fw_file_name, dev); 12054 rc = request_firmware(&bp->firmware, fw_file_name, dev);
12074 if (rc) { 12055 if (rc) {
12075 printk(KERN_ERR PFX "Can't load firmware file %s\n", 12056 pr_err("Can't load firmware file %s\n", fw_file_name);
12076 fw_file_name);
12077 goto request_firmware_exit; 12057 goto request_firmware_exit;
12078 } 12058 }
12079 12059
12080 rc = bnx2x_check_firmware(bp); 12060 rc = bnx2x_check_firmware(bp);
12081 if (rc) { 12061 if (rc) {
12082 printk(KERN_ERR PFX "Corrupt firmware file %s\n", fw_file_name); 12062 pr_err("Corrupt firmware file %s\n", fw_file_name);
12083 goto request_firmware_exit; 12063 goto request_firmware_exit;
12084 } 12064 }
12085 12065
@@ -12138,12 +12118,12 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
12138 /* dev zeroed in init_etherdev */ 12118 /* dev zeroed in init_etherdev */
12139 dev = alloc_etherdev_mq(sizeof(*bp), MAX_CONTEXT); 12119 dev = alloc_etherdev_mq(sizeof(*bp), MAX_CONTEXT);
12140 if (!dev) { 12120 if (!dev) {
12141 printk(KERN_ERR PFX "Cannot allocate net device\n"); 12121 pr_err("Cannot allocate net device\n");
12142 return -ENOMEM; 12122 return -ENOMEM;
12143 } 12123 }
12144 12124
12145 bp = netdev_priv(dev); 12125 bp = netdev_priv(dev);
12146 bp->msglevel = debug; 12126 bp->msg_enable = debug;
12147 12127
12148 pci_set_drvdata(pdev, dev); 12128 pci_set_drvdata(pdev, dev);
12149 12129
@@ -12160,7 +12140,7 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
12160 /* Set init arrays */ 12140 /* Set init arrays */
12161 rc = bnx2x_init_firmware(bp, &pdev->dev); 12141 rc = bnx2x_init_firmware(bp, &pdev->dev);
12162 if (rc) { 12142 if (rc) {
12163 printk(KERN_ERR PFX "Error loading firmware\n"); 12143 pr_err("Error loading firmware\n");
12164 goto init_one_exit; 12144 goto init_one_exit;
12165 } 12145 }
12166 12146
@@ -12171,12 +12151,11 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
12171 } 12151 }
12172 12152
12173 bnx2x_get_pcie_width_speed(bp, &pcie_width, &pcie_speed); 12153 bnx2x_get_pcie_width_speed(bp, &pcie_width, &pcie_speed);
12174 printk(KERN_INFO "%s: %s (%c%d) PCI-E x%d %s found at mem %lx," 12154 netdev_info(dev, "%s (%c%d) PCI-E x%d %s found at mem %lx, IRQ %d, node addr %pM\n",
12175 " IRQ %d, ", dev->name, board_info[ent->driver_data].name, 12155 board_info[ent->driver_data].name,
12176 (CHIP_REV(bp) >> 12) + 'A', (CHIP_METAL(bp) >> 4), 12156 (CHIP_REV(bp) >> 12) + 'A', (CHIP_METAL(bp) >> 4),
12177 pcie_width, (pcie_speed == 2) ? "5GHz (Gen2)" : "2.5GHz", 12157 pcie_width, (pcie_speed == 2) ? "5GHz (Gen2)" : "2.5GHz",
12178 dev->base_addr, bp->pdev->irq); 12158 dev->base_addr, bp->pdev->irq, dev->dev_addr);
12179 printk(KERN_CONT "node addr %pM\n", dev->dev_addr);
12180 12159
12181 return 0; 12160 return 0;
12182 12161
@@ -12204,7 +12183,7 @@ static void __devexit bnx2x_remove_one(struct pci_dev *pdev)
12204 struct bnx2x *bp; 12183 struct bnx2x *bp;
12205 12184
12206 if (!dev) { 12185 if (!dev) {
12207 printk(KERN_ERR PFX "BAD net device from bnx2x_init_one\n"); 12186 pr_err("BAD net device from bnx2x_init_one\n");
12208 return; 12187 return;
12209 } 12188 }
12210 bp = netdev_priv(dev); 12189 bp = netdev_priv(dev);
@@ -12237,7 +12216,7 @@ static int bnx2x_suspend(struct pci_dev *pdev, pm_message_t state)
12237 struct bnx2x *bp; 12216 struct bnx2x *bp;
12238 12217
12239 if (!dev) { 12218 if (!dev) {
12240 printk(KERN_ERR PFX "BAD net device from bnx2x_init_one\n"); 12219 pr_err("BAD net device from bnx2x_init_one\n");
12241 return -ENODEV; 12220 return -ENODEV;
12242 } 12221 }
12243 bp = netdev_priv(dev); 12222 bp = netdev_priv(dev);
@@ -12269,7 +12248,7 @@ static int bnx2x_resume(struct pci_dev *pdev)
12269 int rc; 12248 int rc;
12270 12249
12271 if (!dev) { 12250 if (!dev) {
12272 printk(KERN_ERR PFX "BAD net device from bnx2x_init_one\n"); 12251 pr_err("BAD net device from bnx2x_init_one\n");
12273 return -ENODEV; 12252 return -ENODEV;
12274 } 12253 }
12275 bp = netdev_priv(dev); 12254 bp = netdev_priv(dev);
@@ -12472,17 +12451,17 @@ static int __init bnx2x_init(void)
12472{ 12451{
12473 int ret; 12452 int ret;
12474 12453
12475 printk(KERN_INFO "%s", version); 12454 pr_info("%s", version);
12476 12455
12477 bnx2x_wq = create_singlethread_workqueue("bnx2x"); 12456 bnx2x_wq = create_singlethread_workqueue("bnx2x");
12478 if (bnx2x_wq == NULL) { 12457 if (bnx2x_wq == NULL) {
12479 printk(KERN_ERR PFX "Cannot create workqueue\n"); 12458 pr_err("Cannot create workqueue\n");
12480 return -ENOMEM; 12459 return -ENOMEM;
12481 } 12460 }
12482 12461
12483 ret = pci_register_driver(&bnx2x_pci_driver); 12462 ret = pci_register_driver(&bnx2x_pci_driver);
12484 if (ret) { 12463 if (ret) {
12485 printk(KERN_ERR PFX "Cannot register driver\n"); 12464 pr_err("Cannot register driver\n");
12486 destroy_workqueue(bnx2x_wq); 12465 destroy_workqueue(bnx2x_wq);
12487 } 12466 }
12488 return ret; 12467 return ret;