提交 f1deab50 编写于 作者: J Joe Perches 提交者: David S. Miller

bnx2x: Use pr_fmt and message logging cleanups

Add pr_fmt(fmt) KBUILD_MODNAME ": " to prefix messages with "bnx2x: ".
Remove #define DP_LEVEL and use pr_notice.
Repeating KERN_<LEVEL> isn't necessary in multi-line printks.
printk macro neatening, use fmt and ##__VA_ARGS__.
Coalesce long formats.
Signed-off-by: NJoe Perches <joe@perches.com>
Acked-by: NEilon Greenstein <eilong@broadcom.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 94f05b0f
...@@ -66,69 +66,68 @@ ...@@ -66,69 +66,68 @@
#define BNX2X_MSG_SP 0x100000 /* was: NETIF_MSG_INTR */ #define BNX2X_MSG_SP 0x100000 /* was: NETIF_MSG_INTR */
#define BNX2X_MSG_FP 0x200000 /* was: NETIF_MSG_INTR */ #define BNX2X_MSG_FP 0x200000 /* was: NETIF_MSG_INTR */
#define DP_LEVEL KERN_NOTICE /* was: KERN_DEBUG */
/* regular debug print */ /* regular debug print */
#define DP(__mask, __fmt, __args...) \ #define DP(__mask, fmt, ...) \
do { \ do { \
if (bp->msg_enable & (__mask)) \ if (bp->msg_enable & (__mask)) \
printk(DP_LEVEL "[%s:%d(%s)]" __fmt, \ pr_notice("[%s:%d(%s)]" fmt, \
__func__, __LINE__, \ __func__, __LINE__, \
bp->dev ? (bp->dev->name) : "?", \ bp->dev ? (bp->dev->name) : "?", \
##__args); \ ##__VA_ARGS__); \
} while (0) } while (0)
#define DP_CONT(__mask, __fmt, __args...) \ #define DP_CONT(__mask, fmt, ...) \
do { \ do { \
if (bp->msg_enable & (__mask)) \ if (bp->msg_enable & (__mask)) \
pr_cont(__fmt, ##__args); \ pr_cont(fmt, ##__VA_ARGS__); \
} while (0) } while (0)
/* errors debug print */ /* errors debug print */
#define BNX2X_DBG_ERR(__fmt, __args...) \ #define BNX2X_DBG_ERR(fmt, ...) \
do { \ do { \
if (netif_msg_probe(bp)) \ if (netif_msg_probe(bp)) \
pr_err("[%s:%d(%s)]" __fmt, \ pr_err("[%s:%d(%s)]" fmt, \
__func__, __LINE__, \ __func__, __LINE__, \
bp->dev ? (bp->dev->name) : "?", \ bp->dev ? (bp->dev->name) : "?", \
##__args); \ ##__VA_ARGS__); \
} while (0) } while (0)
/* for errors (never masked) */ /* for errors (never masked) */
#define BNX2X_ERR(__fmt, __args...) \ #define BNX2X_ERR(fmt, ...) \
do { \ do { \
pr_err("[%s:%d(%s)]" __fmt, \ pr_err("[%s:%d(%s)]" fmt, \
__func__, __LINE__, \ __func__, __LINE__, \
bp->dev ? (bp->dev->name) : "?", \ bp->dev ? (bp->dev->name) : "?", \
##__args); \ ##__VA_ARGS__); \
} while (0) } while (0)
#define BNX2X_ERROR(__fmt, __args...) do { \ #define BNX2X_ERROR(fmt, ...) \
pr_err("[%s:%d]" __fmt, __func__, __LINE__, ##__args); \ pr_err("[%s:%d]" fmt, __func__, __LINE__, ##__VA_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...) \ #define BNX2X_DEV_INFO(fmt, ...) \
do { \ do { \
if (netif_msg_probe(bp)) \ if (netif_msg_probe(bp)) \
dev_info(&bp->pdev->dev, __fmt, ##__args); \ dev_info(&bp->pdev->dev, fmt, ##__VA_ARGS__); \
} while (0) } while (0)
#ifdef BNX2X_STOP_ON_ERROR #ifdef BNX2X_STOP_ON_ERROR
void bnx2x_int_disable(struct bnx2x *bp); void bnx2x_int_disable(struct bnx2x *bp);
#define bnx2x_panic() do { \ #define bnx2x_panic() \
bp->panic = 1; \ do { \
BNX2X_ERR("driver assert\n"); \ bp->panic = 1; \
bnx2x_int_disable(bp); \ BNX2X_ERR("driver assert\n"); \
bnx2x_panic_dump(bp); \ bnx2x_int_disable(bp); \
} while (0) bnx2x_panic_dump(bp); \
} while (0)
#else #else
#define bnx2x_panic() do { \ #define bnx2x_panic() \
bp->panic = 1; \ do { \
BNX2X_ERR("driver assert\n"); \ bp->panic = 1; \
bnx2x_panic_dump(bp); \ BNX2X_ERR("driver assert\n"); \
} while (0) bnx2x_panic_dump(bp); \
} while (0)
#endif #endif
#define bnx2x_mc_addr(ha) ((ha)->addr) #define bnx2x_mc_addr(ha) ((ha)->addr)
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
* *
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/if_vlan.h> #include <linux/if_vlan.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
...@@ -3369,7 +3371,7 @@ int bnx2x_change_mtu(struct net_device *dev, int new_mtu) ...@@ -3369,7 +3371,7 @@ int bnx2x_change_mtu(struct net_device *dev, int new_mtu)
struct bnx2x *bp = netdev_priv(dev); struct bnx2x *bp = netdev_priv(dev);
if (bp->recovery_state != BNX2X_RECOVERY_DONE) { if (bp->recovery_state != BNX2X_RECOVERY_DONE) {
printk(KERN_ERR "Handling parity error recovery. Try again later\n"); pr_err("Handling parity error recovery. Try again later\n");
return -EAGAIN; return -EAGAIN;
} }
...@@ -3495,7 +3497,7 @@ int bnx2x_resume(struct pci_dev *pdev) ...@@ -3495,7 +3497,7 @@ int bnx2x_resume(struct pci_dev *pdev)
bp = netdev_priv(dev); bp = netdev_priv(dev);
if (bp->recovery_state != BNX2X_RECOVERY_DONE) { if (bp->recovery_state != BNX2X_RECOVERY_DONE) {
printk(KERN_ERR "Handling parity error recovery. Try again later\n"); pr_err("Handling parity error recovery. Try again later\n");
return -EAGAIN; return -EAGAIN;
} }
......
...@@ -16,6 +16,9 @@ ...@@ -16,6 +16,9 @@
* Written by: Dmitry Kravkov * Written by: Dmitry Kravkov
* *
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/errno.h> #include <linux/errno.h>
......
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
* Statistics and Link management by Yitchak Gertner * Statistics and Link management by Yitchak Gertner
* *
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/ethtool.h> #include <linux/ethtool.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -239,9 +242,9 @@ static int bnx2x_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -239,9 +242,9 @@ static int bnx2x_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
cmd->maxrxpkt = 0; cmd->maxrxpkt = 0;
DP(NETIF_MSG_LINK, "ethtool_cmd: cmd %d\n" DP(NETIF_MSG_LINK, "ethtool_cmd: cmd %d\n"
DP_LEVEL " supported 0x%x advertising 0x%x speed %u\n" " supported 0x%x advertising 0x%x speed %u\n"
DP_LEVEL " duplex %d port %d phy_address %d transceiver %d\n" " duplex %d port %d phy_address %d transceiver %d\n"
DP_LEVEL " autoneg %d maxtxpkt %d maxrxpkt %d\n", " autoneg %d maxtxpkt %d maxrxpkt %d\n",
cmd->cmd, cmd->supported, cmd->advertising, cmd->cmd, cmd->supported, cmd->advertising,
ethtool_cmd_speed(cmd), ethtool_cmd_speed(cmd),
cmd->duplex, cmd->port, cmd->phy_address, cmd->transceiver, cmd->duplex, cmd->port, cmd->phy_address, cmd->transceiver,
...@@ -482,7 +485,7 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -482,7 +485,7 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
} }
DP(NETIF_MSG_LINK, "req_line_speed %d\n" DP(NETIF_MSG_LINK, "req_line_speed %d\n"
DP_LEVEL " req_duplex %d advertising 0x%x\n", " req_duplex %d advertising 0x%x\n",
bp->link_params.req_line_speed[cfg_idx], bp->link_params.req_line_speed[cfg_idx],
bp->link_params.req_duplex[cfg_idx], bp->link_params.req_duplex[cfg_idx],
bp->port.advertising[cfg_idx]); bp->port.advertising[cfg_idx]);
...@@ -1028,7 +1031,7 @@ static int bnx2x_get_eeprom(struct net_device *dev, ...@@ -1028,7 +1031,7 @@ static int bnx2x_get_eeprom(struct net_device *dev,
return -EAGAIN; return -EAGAIN;
DP(BNX2X_MSG_NVM, "ethtool_eeprom: cmd %d\n" DP(BNX2X_MSG_NVM, "ethtool_eeprom: cmd %d\n"
DP_LEVEL " magic 0x%x offset 0x%x (%d) len 0x%x (%d)\n", " magic 0x%x offset 0x%x (%d) len 0x%x (%d)\n",
eeprom->cmd, eeprom->magic, eeprom->offset, eeprom->offset, eeprom->cmd, eeprom->magic, eeprom->offset, eeprom->offset,
eeprom->len, eeprom->len); eeprom->len, eeprom->len);
...@@ -1199,7 +1202,7 @@ static int bnx2x_set_eeprom(struct net_device *dev, ...@@ -1199,7 +1202,7 @@ static int bnx2x_set_eeprom(struct net_device *dev,
return -EAGAIN; return -EAGAIN;
DP(BNX2X_MSG_NVM, "ethtool_eeprom: cmd %d\n" DP(BNX2X_MSG_NVM, "ethtool_eeprom: cmd %d\n"
DP_LEVEL " magic 0x%x offset 0x%x (%d) len 0x%x (%d)\n", " magic 0x%x offset 0x%x (%d) len 0x%x (%d)\n",
eeprom->cmd, eeprom->magic, eeprom->offset, eeprom->offset, eeprom->cmd, eeprom->magic, eeprom->offset, eeprom->offset,
eeprom->len, eeprom->len); eeprom->len, eeprom->len);
...@@ -1328,7 +1331,7 @@ static int bnx2x_set_ringparam(struct net_device *dev, ...@@ -1328,7 +1331,7 @@ static int bnx2x_set_ringparam(struct net_device *dev,
struct bnx2x *bp = netdev_priv(dev); struct bnx2x *bp = netdev_priv(dev);
if (bp->recovery_state != BNX2X_RECOVERY_DONE) { if (bp->recovery_state != BNX2X_RECOVERY_DONE) {
printk(KERN_ERR "Handling parity error recovery. Try again later\n"); pr_err("Handling parity error recovery. Try again later\n");
return -EAGAIN; return -EAGAIN;
} }
...@@ -1359,7 +1362,7 @@ static void bnx2x_get_pauseparam(struct net_device *dev, ...@@ -1359,7 +1362,7 @@ static void bnx2x_get_pauseparam(struct net_device *dev,
BNX2X_FLOW_CTRL_TX); BNX2X_FLOW_CTRL_TX);
DP(NETIF_MSG_LINK, "ethtool_pauseparam: cmd %d\n" DP(NETIF_MSG_LINK, "ethtool_pauseparam: cmd %d\n"
DP_LEVEL " autoneg %d rx_pause %d tx_pause %d\n", " autoneg %d rx_pause %d tx_pause %d\n",
epause->cmd, epause->autoneg, epause->rx_pause, epause->tx_pause); epause->cmd, epause->autoneg, epause->rx_pause, epause->tx_pause);
} }
...@@ -1372,7 +1375,7 @@ static int bnx2x_set_pauseparam(struct net_device *dev, ...@@ -1372,7 +1375,7 @@ static int bnx2x_set_pauseparam(struct net_device *dev,
return 0; return 0;
DP(NETIF_MSG_LINK, "ethtool_pauseparam: cmd %d\n" DP(NETIF_MSG_LINK, "ethtool_pauseparam: cmd %d\n"
DP_LEVEL " autoneg %d rx_pause %d tx_pause %d\n", " autoneg %d rx_pause %d tx_pause %d\n",
epause->cmd, epause->autoneg, epause->rx_pause, epause->tx_pause); epause->cmd, epause->autoneg, epause->rx_pause, epause->tx_pause);
bp->link_params.req_flow_ctrl[cfg_idx] = BNX2X_FLOW_CTRL_AUTO; bp->link_params.req_flow_ctrl[cfg_idx] = BNX2X_FLOW_CTRL_AUTO;
...@@ -1970,7 +1973,7 @@ static void bnx2x_self_test(struct net_device *dev, ...@@ -1970,7 +1973,7 @@ static void bnx2x_self_test(struct net_device *dev,
struct bnx2x *bp = netdev_priv(dev); struct bnx2x *bp = netdev_priv(dev);
u8 is_serdes; u8 is_serdes;
if (bp->recovery_state != BNX2X_RECOVERY_DONE) { if (bp->recovery_state != BNX2X_RECOVERY_DONE) {
printk(KERN_ERR "Handling parity error recovery. Try again later\n"); pr_err("Handling parity error recovery. Try again later\n");
etest->flags |= ETH_TEST_FL_FAILED; etest->flags |= ETH_TEST_FL_FAILED;
return; return;
} }
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
* *
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -350,17 +352,15 @@ static void bnx2x_dp_dmae(struct bnx2x *bp, struct dmae_command *dmae, ...@@ -350,17 +352,15 @@ static void bnx2x_dp_dmae(struct bnx2x *bp, struct dmae_command *dmae,
default: default:
if (src_type == DMAE_CMD_SRC_PCI) if (src_type == DMAE_CMD_SRC_PCI)
DP(msglvl, "DMAE: opcode 0x%08x\n" DP(msglvl, "DMAE: opcode 0x%08x\n"
DP_LEVEL "src_addr [%x:%08x] len [%d * 4] " "src_addr [%x:%08x] len [%d * 4] dst_addr [none]\n"
"dst_addr [none]\n" "comp_addr [%x:%08x] comp_val 0x%08x\n",
DP_LEVEL "comp_addr [%x:%08x] comp_val 0x%08x\n",
dmae->opcode, dmae->src_addr_hi, dmae->src_addr_lo, dmae->opcode, dmae->src_addr_hi, dmae->src_addr_lo,
dmae->len, dmae->comp_addr_hi, dmae->comp_addr_lo, dmae->len, dmae->comp_addr_hi, dmae->comp_addr_lo,
dmae->comp_val); dmae->comp_val);
else else
DP(msglvl, "DMAE: opcode 0x%08x\n" DP(msglvl, "DMAE: opcode 0x%08x\n"
DP_LEVEL "src_addr [%08x] len [%d * 4] " "src_addr [%08x] len [%d * 4] dst_addr [none]\n"
"dst_addr [none]\n" "comp_addr [%x:%08x] comp_val 0x%08x\n",
DP_LEVEL "comp_addr [%x:%08x] comp_val 0x%08x\n",
dmae->opcode, dmae->src_addr_lo >> 2, dmae->opcode, dmae->src_addr_lo >> 2,
dmae->len, dmae->comp_addr_hi, dmae->comp_addr_lo, dmae->len, dmae->comp_addr_hi, dmae->comp_addr_lo,
dmae->comp_val); dmae->comp_val);
...@@ -789,18 +789,15 @@ void bnx2x_panic_dump(struct bnx2x *bp) ...@@ -789,18 +789,15 @@ void bnx2x_panic_dump(struct bnx2x *bp)
BNX2X_ERR(" def ("); BNX2X_ERR(" def (");
for (i = 0; i < HC_SP_SB_MAX_INDICES; i++) for (i = 0; i < HC_SP_SB_MAX_INDICES; i++)
pr_cont("0x%x%s", pr_cont("0x%x%s",
bp->def_status_blk->sp_sb.index_values[i], bp->def_status_blk->sp_sb.index_values[i],
(i == HC_SP_SB_MAX_INDICES - 1) ? ") " : " "); (i == HC_SP_SB_MAX_INDICES - 1) ? ") " : " ");
for (i = 0; i < sizeof(struct hc_sp_status_block_data)/sizeof(u32); i++) for (i = 0; i < sizeof(struct hc_sp_status_block_data)/sizeof(u32); i++)
*((u32 *)&sp_sb_data + i) = REG_RD(bp, BAR_CSTRORM_INTMEM + *((u32 *)&sp_sb_data + i) = REG_RD(bp, BAR_CSTRORM_INTMEM +
CSTORM_SP_STATUS_BLOCK_DATA_OFFSET(func) + CSTORM_SP_STATUS_BLOCK_DATA_OFFSET(func) +
i*sizeof(u32)); i*sizeof(u32));
pr_cont("igu_sb_id(0x%x) igu_seg_id(0x%x) " pr_cont("igu_sb_id(0x%x) igu_seg_id(0x%x) pf_id(0x%x) vnic_id(0x%x) vf_id(0x%x) vf_valid (0x%x) state(0x%x)\n",
"pf_id(0x%x) vnic_id(0x%x) "
"vf_id(0x%x) vf_valid (0x%x) "
"state(0x%x)\n",
sp_sb_data.igu_sb_id, sp_sb_data.igu_sb_id,
sp_sb_data.igu_seg_id, sp_sb_data.igu_seg_id,
sp_sb_data.p_func.pf_id, sp_sb_data.p_func.pf_id,
...@@ -3721,9 +3718,7 @@ static inline void bnx2x_clear_load_cnt(struct bnx2x *bp) ...@@ -3721,9 +3718,7 @@ static inline void bnx2x_clear_load_cnt(struct bnx2x *bp)
static inline void _print_next_block(int idx, const char *blk) static inline void _print_next_block(int idx, const char *blk)
{ {
if (idx) pr_cont("%s%s", idx ? ", " : "", blk);
pr_cont(", ");
pr_cont("%s", blk);
} }
static inline int bnx2x_check_blocks_with_parity0(u32 sig, int par_num, static inline int bnx2x_check_blocks_with_parity0(u32 sig, int par_num,
......
...@@ -16,6 +16,9 @@ ...@@ -16,6 +16,9 @@
* Written by: Vladislav Zolotarov * Written by: Vladislav Zolotarov
* *
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/crc32.h> #include <linux/crc32.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
......
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
* Statistics and Link management by Yitchak Gertner * Statistics and Link management by Yitchak Gertner
* *
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include "bnx2x_stats.h" #include "bnx2x_stats.h"
#include "bnx2x_cmn.h" #include "bnx2x_cmn.h"
...@@ -1194,14 +1197,13 @@ static void bnx2x_stats_update(struct bnx2x *bp) ...@@ -1194,14 +1197,13 @@ static void bnx2x_stats_update(struct bnx2x *bp)
struct bnx2x_fastpath *fp = &bp->fp[i]; struct bnx2x_fastpath *fp = &bp->fp[i];
struct bnx2x_eth_q_stats *qstats = &fp->eth_q_stats; struct bnx2x_eth_q_stats *qstats = &fp->eth_q_stats;
printk(KERN_DEBUG "%s: rx usage(%4u) *rx_cons_sb(%u)" pr_debug("%s: rx usage(%4u) *rx_cons_sb(%u) rx pkt(%lu) rx calls(%lu %lu)\n",
" rx pkt(%lu) rx calls(%lu %lu)\n", fp->name, (le16_to_cpu(*fp->rx_cons_sb) -
fp->name, (le16_to_cpu(*fp->rx_cons_sb) - fp->rx_comp_cons),
fp->rx_comp_cons), le16_to_cpu(*fp->rx_cons_sb),
le16_to_cpu(*fp->rx_cons_sb), bnx2x_hilo(&qstats->
bnx2x_hilo(&qstats-> total_unicast_packets_received_hi),
total_unicast_packets_received_hi), fp->rx_calls, fp->rx_pkt);
fp->rx_calls, fp->rx_pkt);
} }
for_each_eth_queue(bp, i) { for_each_eth_queue(bp, i) {
...@@ -1210,27 +1212,25 @@ static void bnx2x_stats_update(struct bnx2x *bp) ...@@ -1210,27 +1212,25 @@ static void bnx2x_stats_update(struct bnx2x *bp)
struct bnx2x_eth_q_stats *qstats = &fp->eth_q_stats; struct bnx2x_eth_q_stats *qstats = &fp->eth_q_stats;
struct netdev_queue *txq; struct netdev_queue *txq;
printk(KERN_DEBUG "%s: tx pkt(%lu) (Xoff events %u)", pr_debug("%s: tx pkt(%lu) (Xoff events %u)",
fp->name, bnx2x_hilo( fp->name,
&qstats->total_unicast_packets_transmitted_hi), bnx2x_hilo(
qstats->driver_xoff); &qstats->total_unicast_packets_transmitted_hi),
qstats->driver_xoff);
for_each_cos_in_tx_queue(fp, cos) { for_each_cos_in_tx_queue(fp, cos) {
txdata = &fp->txdata[cos]; txdata = &fp->txdata[cos];
txq = netdev_get_tx_queue(bp->dev, txq = netdev_get_tx_queue(bp->dev,
FP_COS_TO_TXQ(fp, cos)); FP_COS_TO_TXQ(fp, cos));
printk(KERN_DEBUG "%d: tx avail(%4u)" pr_debug("%d: tx avail(%4u) *tx_cons_sb(%u) tx calls (%lu) %s\n",
" *tx_cons_sb(%u)" cos,
" tx calls (%lu)" bnx2x_tx_avail(bp, txdata),
" %s\n", le16_to_cpu(*txdata->tx_cons_sb),
cos, txdata->tx_pkt,
bnx2x_tx_avail(bp, txdata), (netif_tx_queue_stopped(txq) ?
le16_to_cpu(*txdata->tx_cons_sb), "Xoff" : "Xon")
txdata->tx_pkt, );
(netif_tx_queue_stopped(txq) ?
"Xoff" : "Xon")
);
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册