Skip to content

Commit

Permalink
net/bnxt: use dynamic log type
Browse files Browse the repository at this point in the history
This patch implements driver specific log type doing away with
usage of RTE_LOG() for logging.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
  • Loading branch information
ajitkhaparde authored and Ferruh Yigit committed Jan 29, 2018
1 parent c771d28 commit 3e92fd4
Show file tree
Hide file tree
Showing 13 changed files with 300 additions and 288 deletions.
8 changes: 8 additions & 0 deletions drivers/net/bnxt/bnxt.h
Original file line number Diff line number Diff line change
Expand Up @@ -334,4 +334,12 @@ int bnxt_rcv_msg_from_vf(struct bnxt *bp, uint16_t vf_id, void *msg);

bool is_bnxt_supported(struct rte_eth_dev *dev);
extern const struct rte_flow_ops bnxt_flow_ops;

extern int bnxt_logtype_driver;
#define PMD_DRV_LOG_RAW(level, fmt, args...) \
rte_log(RTE_LOG_ ## level, bnxt_logtype_driver, "%s(): " fmt, \
__func__, ## args)

#define PMD_DRV_LOG(level, fmt, args...) \
PMD_DRV_LOG_RAW(level, fmt, ## args)
#endif
10 changes: 5 additions & 5 deletions drivers/net/bnxt/bnxt_cpr.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void bnxt_handle_async_event(struct bnxt *bp,
bnxt_link_update_op(bp->eth_dev, 1);
break;
default:
RTE_LOG(DEBUG, PMD, "handle_async_event id = 0x%x\n", event_id);
PMD_DRV_LOG(DEBUG, "handle_async_event id = 0x%x\n", event_id);
break;
}
}
Expand All @@ -74,7 +74,7 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
int rc;

if (bp->pf.active_vfs <= 0) {
RTE_LOG(ERR, PMD, "Forwarded VF with no active VFs\n");
PMD_DRV_LOG(ERR, "Forwarded VF with no active VFs\n");
return;
}

Expand All @@ -93,7 +93,7 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)

if (fw_vf_id < bp->pf.first_vf_id ||
fw_vf_id >= (bp->pf.first_vf_id) + bp->pf.active_vfs) {
RTE_LOG(ERR, PMD,
PMD_DRV_LOG(ERR,
"FWD req's source_id 0x%x out of range 0x%x - 0x%x (%d %d)\n",
fw_vf_id, bp->pf.first_vf_id,
(bp->pf.first_vf_id) + bp->pf.active_vfs - 1,
Expand Down Expand Up @@ -130,7 +130,7 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
/* Forward */
rc = bnxt_hwrm_exec_fwd_resp(bp, fw_vf_id, fwd_cmd, req_len);
if (rc) {
RTE_LOG(ERR, PMD,
PMD_DRV_LOG(ERR,
"Failed to send FWD req VF 0x%x, type 0x%x.\n",
fw_vf_id - bp->pf.first_vf_id,
rte_le_to_cpu_16(fwd_cmd->req_type));
Expand All @@ -141,7 +141,7 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
reject:
rc = bnxt_hwrm_reject_fwd_resp(bp, fw_vf_id, fwd_cmd, req_len);
if (rc) {
RTE_LOG(ERR, PMD,
PMD_DRV_LOG(ERR,
"Failed to send REJECT req VF 0x%x, type 0x%x.\n",
fw_vf_id - bp->pf.first_vf_id,
rte_le_to_cpu_16(fwd_cmd->req_type));
Expand Down

0 comments on commit 3e92fd4

Please sign in to comment.