DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 05/11] i40e: clean log messages
Date: Tue, 26 Aug 2014 16:09:15 +0200	[thread overview]
Message-ID: <1409062162-19575-6-git-send-email-david.marchand@6wind.com> (raw)
In-Reply-To: <1409062162-19575-1-git-send-email-david.marchand@6wind.com>

Clean log messages:
- remove superfluous \n in log macros and add some \n where needed,
- remove leading \n in some messages,
- split multi lines messages,
- replace some PMD_INIT_LOG(DEBUG, "some_func\n") with PMD_INIT_FUNC_TRACE().

Signed-off-by: David Marchand <david.marchand@6wind.com>
---
 lib/librte_pmd_i40e/i40e/i40e_osdep.h |    2 +-
 lib/librte_pmd_i40e/i40e_ethdev.c     |   43 +++++++++++++++++----------------
 lib/librte_pmd_i40e/i40e_ethdev_vf.c  |    4 +--
 lib/librte_pmd_i40e/i40e_logs.h       |   12 ++++-----
 lib/librte_pmd_i40e/i40e_pf.c         |    4 +--
 lib/librte_pmd_i40e/i40e_rxtx.c       |    6 ++---
 6 files changed, 36 insertions(+), 35 deletions(-)

diff --git a/lib/librte_pmd_i40e/i40e/i40e_osdep.h b/lib/librte_pmd_i40e/i40e/i40e_osdep.h
index 0ed4b65..5f1c98f 100644
--- a/lib/librte_pmd_i40e/i40e/i40e_osdep.h
+++ b/lib/librte_pmd_i40e/i40e/i40e_osdep.h
@@ -112,7 +112,7 @@ typedef enum i40e_status_code i40e_status;
 #define i40e_debug(h, m, s, ...)                                \
 do {                                                            \
 	if (((m) & (h)->debug_mask))                            \
-		PMD_DRV_LOG(DEBUG, "i40e %02x.%x " s,           \
+		PMD_DRV_LOG(DEBUG, "i40e %02x.%x\n" s,          \
 			(h)->bus.device, (h)->bus.func,         \
 					##__VA_ARGS__);         \
 } while (0)
diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c
index 4e65ca4..d6104ed 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev.c
@@ -388,14 +388,15 @@ eth_i40e_dev_init(__rte_unused struct eth_driver *eth_drv,
 	/* Reset here to make sure all is clean for each PF */
 	ret = i40e_pf_reset(hw);
 	if (ret) {
-		PMD_INIT_LOG(ERR, "Failed to reset pf: %d", ret);
+		PMD_INIT_LOG(ERR, "Failed to reset pf: %d\n", ret);
 		return ret;
 	}
 
 	/* Initialize the shared code (base driver) */
 	ret = i40e_init_shared_code(hw);
 	if (ret) {
-		PMD_INIT_LOG(ERR, "Failed to init shared code (base driver): %d", ret);
+		PMD_INIT_LOG(ERR, "Failed to init shared code (base driver):"
+			     "%d\n", ret);
 		return ret;
 	}
 
@@ -403,7 +404,7 @@ eth_i40e_dev_init(__rte_unused struct eth_driver *eth_drv,
 	i40e_init_adminq_parameter(hw);
 	ret = i40e_init_adminq(hw);
 	if (ret != I40E_SUCCESS) {
-		PMD_INIT_LOG(ERR, "Failed to init adminq: %d", ret);
+		PMD_INIT_LOG(ERR, "Failed to init adminq: %d\n", ret);
 		return -EIO;
 	}
 	PMD_INIT_LOG(INFO, "FW %d.%d API %d.%d NVM "
@@ -425,14 +426,14 @@ eth_i40e_dev_init(__rte_unused struct eth_driver *eth_drv,
 	/* Get hw capabilities */
 	ret = i40e_get_cap(hw);
 	if (ret != I40E_SUCCESS) {
-		PMD_INIT_LOG(ERR, "Failed to get capabilities: %d", ret);
+		PMD_INIT_LOG(ERR, "Failed to get capabilities: %d\n", ret);
 		goto err_get_capabilities;
 	}
 
 	/* Initialize parameters for PF */
 	ret = i40e_pf_parameter_init(dev);
 	if (ret != 0) {
-		PMD_INIT_LOG(ERR, "Failed to do parameter init: %d", ret);
+		PMD_INIT_LOG(ERR, "Failed to do parameter init: %d\n", ret);
 		goto err_parameter_init;
 	}
 
@@ -453,21 +454,21 @@ eth_i40e_dev_init(__rte_unused struct eth_driver *eth_drv,
 	ret = i40e_init_lan_hmc(hw, hw->func_caps.num_tx_qp,
 				hw->func_caps.num_rx_qp, 0, 0);
 	if (ret != I40E_SUCCESS) {
-		PMD_INIT_LOG(ERR, "Failed to init lan hmc: %d", ret);
+		PMD_INIT_LOG(ERR, "Failed to init lan hmc: %d\n", ret);
 		goto err_init_lan_hmc;
 	}
 
 	/* Configure lan hmc */
 	ret = i40e_configure_lan_hmc(hw, I40E_HMC_MODEL_DIRECT_ONLY);
 	if (ret != I40E_SUCCESS) {
-		PMD_INIT_LOG(ERR, "Failed to configure lan hmc: %d", ret);
+		PMD_INIT_LOG(ERR, "Failed to configure lan hmc: %d\n", ret);
 		goto err_configure_lan_hmc;
 	}
 
 	/* Get and check the mac address */
 	i40e_get_mac_addr(hw, hw->mac.addr);
 	if (i40e_validate_mac_addr(hw->mac.addr) != I40E_SUCCESS) {
-		PMD_INIT_LOG(ERR, "mac address is not valid");
+		PMD_INIT_LOG(ERR, "mac address is not valid\n");
 		ret = -EIO;
 		goto err_get_mac_addr;
 	}
@@ -482,7 +483,7 @@ eth_i40e_dev_init(__rte_unused struct eth_driver *eth_drv,
 	/* PF setup, which includes VSI setup */
 	ret = i40e_pf_setup(pf);
 	if (ret) {
-		PMD_INIT_LOG(ERR, "Failed to setup pf switch: %d", ret);
+		PMD_INIT_LOG(ERR, "Failed to setup pf switch: %d\n", ret);
 		goto err_setup_pf_switch;
 	}
 
@@ -499,8 +500,8 @@ eth_i40e_dev_init(__rte_unused struct eth_driver *eth_drv,
 	/* Should be after VSI initialized */
 	dev->data->mac_addrs = rte_zmalloc("i40e", len, 0);
 	if (!dev->data->mac_addrs) {
-		PMD_INIT_LOG(ERR, "Failed to allocated memory "
-					"for storing mac address");
+		PMD_INIT_LOG(ERR, "Failed to allocated memory for storing "
+			     "mac address\n");
 		goto err_get_mac_addr;
 	}
 	ether_addr_copy((struct ether_addr *)hw->mac.perm_addr,
@@ -723,9 +724,9 @@ i40e_phy_conf_link(struct i40e_hw *hw, uint8_t abilities, uint8_t force_speed)
 	phy_conf.eeer = phy_ab.eeer_val;
 	phy_conf.low_power_ctrl = phy_ab.d3_lpan;
 
-	PMD_DRV_LOG(DEBUG, "\n\tCurrent: abilities %x, link_speed %x\n"
-		    "\tConfig:  abilities %x, link_speed %x",
-		    phy_ab.abilities, phy_ab.link_speed,
+	PMD_DRV_LOG(DEBUG, "\tCurrent: abilities %x, link_speed %x\n"
+		    phy_ab.abilities, phy_ab.link_speed);
+	PMD_DRV_LOG(DEBUG, "\tConfig:  abilities %x, link_speed %x\n",
 		    phy_conf.abilities, phy_conf.link_speed);
 
 	status = i40e_aq_set_phy_config(hw, &phy_conf, NULL);
@@ -2521,7 +2522,7 @@ i40e_vsi_dump_bw_config(struct i40e_vsi *vsi)
 					ets_sla_config.share_credits[i]);
 		PMD_DRV_LOG(INFO, "\tVSI TC%u:credits %u\n", i,
 			rte_le_to_cpu_16(ets_sla_config.credits[i]));
-		PMD_DRV_LOG(INFO, "\tVSI TC%u: max credits: %u", i,
+		PMD_DRV_LOG(INFO, "\tVSI TC%u: max credits: %u\n", i,
 			rte_le_to_cpu_16(ets_sla_config.credits[i / 4]) >>
 								(i * 4));
 	}
@@ -2589,7 +2590,7 @@ i40e_vsi_setup(struct i40e_pf *pf,
 	}
 	ret = i40e_res_pool_alloc(&pf->qp_pool, vsi->nb_qps);
 	if (ret < 0) {
-		PMD_DRV_LOG(ERR, "VSI %d allocate queue failed %d",
+		PMD_DRV_LOG(ERR, "VSI %d allocate queue failed %d\n",
 				vsi->seid, ret);
 		goto fail_mem;
 	}
@@ -2599,7 +2600,7 @@ i40e_vsi_setup(struct i40e_pf *pf,
 	if (type != I40E_VSI_SRIOV) {
 		ret = i40e_res_pool_alloc(&pf->msix_pool, 1);
 		if (ret < 0) {
-			PMD_DRV_LOG(ERR, "VSI %d get heap failed %d", vsi->seid, ret);
+			PMD_DRV_LOG(ERR, "VSI %d get heap failed %d\n", vsi->seid, ret);
 			goto fail_queue_alloc;
 		}
 		vsi->msix_intr = ret;
@@ -2909,14 +2910,14 @@ i40e_pf_setup(struct i40e_pf *pf)
 
 	ret = i40e_pf_get_switch_config(pf);
 	if (ret != I40E_SUCCESS) {
-		PMD_DRV_LOG(ERR, "Could not get switch config, err %d", ret);
+		PMD_DRV_LOG(ERR, "Could not get switch config, err %d\n", ret);
 		return ret;
 	}
 
 	/* VSI setup */
 	vsi = i40e_vsi_setup(pf, I40E_VSI_MAIN, NULL, 0);
 	if (!vsi) {
-		PMD_DRV_LOG(ERR, "Setup of main vsi failed");
+		PMD_DRV_LOG(ERR, "Setup of main vsi failed\n");
 		return I40E_ERR_NOT_READY;
 	}
 	pf->main_vsi = vsi;
@@ -2931,8 +2932,8 @@ i40e_pf_setup(struct i40e_pf *pf)
 	settings.enable_macvlan = TRUE;
 	ret = i40e_set_filter_control(hw, &settings);
 	if (ret)
-		PMD_INIT_LOG(WARNING, "setup_pf_filter_control failed: %d",
-								ret);
+		PMD_INIT_LOG(WARNING, "setup_pf_filter_control failed: %d\n",
+			     ret);
 
 	/* Update flow control according to the auto negotiation */
 	i40e_update_flow_control(hw);
diff --git a/lib/librte_pmd_i40e/i40e_ethdev_vf.c b/lib/librte_pmd_i40e/i40e_ethdev_vf.c
index d8552ad..7672aa8 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev_vf.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev_vf.c
@@ -1101,7 +1101,7 @@ i40evf_dev_init(__rte_unused struct eth_driver *eth_drv,
 					ETHER_ADDR_LEN, 0);
 	if (eth_dev->data->mac_addrs == NULL) {
 		PMD_INIT_LOG(ERR, "Failed to allocate %d bytes needed to "
-				"store MAC addresses", ETHER_ADDR_LEN);
+				"store MAC addresses\n", ETHER_ADDR_LEN);
 		return -ENOMEM;
 	}
 	ether_addr_copy((struct ether_addr *)hw->mac.addr,
@@ -1384,7 +1384,7 @@ i40evf_dev_start(struct rte_eth_dev *dev)
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct ether_addr mac_addr;
 
-	PMD_DRV_LOG(DEBUG, "i40evf_dev_start");
+	PMD_INIT_FUNC_TRACE();
 
 	vf->max_pkt_len = dev->data->dev_conf.rxmode.max_rx_pkt_len;
 	if (dev->data->dev_conf.rxmode.jumbo_frame == 1) {
diff --git a/lib/librte_pmd_i40e/i40e_logs.h b/lib/librte_pmd_i40e/i40e_logs.h
index f991dd2..b78e2a1 100644
--- a/lib/librte_pmd_i40e/i40e_logs.h
+++ b/lib/librte_pmd_i40e/i40e_logs.h
@@ -36,8 +36,8 @@
 
 #ifdef RTE_LIBRTE_I40E_DEBUG_INIT
 #define PMD_INIT_LOG(level, fmt, args...) \
-	RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
-#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>")
+	RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
+#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>\n")
 #else
 #define PMD_INIT_LOG(level, fmt, args...) do { } while(0)
 #define PMD_INIT_FUNC_TRACE() do { } while(0)
@@ -45,28 +45,28 @@
 
 #ifdef RTE_LIBRTE_I40E_DEBUG_RX
 #define PMD_RX_LOG(level, fmt, args...) \
-	RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+	RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
 #else
 #define PMD_RX_LOG(level, fmt, args...) do { } while(0)
 #endif
 
 #ifdef RTE_LIBRTE_I40E_DEBUG_TX
 #define PMD_TX_LOG(level, fmt, args...) \
-	RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+	RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
 #else
 #define PMD_TX_LOG(level, fmt, args...) do { } while(0)
 #endif
 
 #ifdef RTE_LIBRTE_I40E_DEBUG_TX_FREE
 #define PMD_TX_FREE_LOG(level, fmt, args...) \
-	RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+	RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
 #else
 #define PMD_TX_FREE_LOG(level, fmt, args...) do { } while(0)
 #endif
 
 #ifdef RTE_LIBRTE_I40E_DEBUG_DRIVER
 #define PMD_DRV_LOG(level, fmt, args...) \
-	RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+	RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
 #else
 #define PMD_DRV_LOG(level, fmt, args...) do { } while(0)
 #endif
diff --git a/lib/librte_pmd_i40e/i40e_pf.c b/lib/librte_pmd_i40e/i40e_pf.c
index e8b154d..0a726d6 100644
--- a/lib/librte_pmd_i40e/i40e_pf.c
+++ b/lib/librte_pmd_i40e/i40e_pf.c
@@ -439,7 +439,7 @@ i40e_pf_host_process_cmd_config_vsi_queues(struct i40e_pf_vf *vf,
 		/* Apply VF RX queue setting to HMC */
 		if (i40e_pf_host_hmc_config_rxq(hw, vf, &qpair[i].rxq)
 			!= I40E_SUCCESS) {
-			PMD_DRV_LOG(ERR, "Configure RX queue HMC failed");
+			PMD_DRV_LOG(ERR, "Configure RX queue HMC failed\n");
 			ret = I40E_ERR_PARAM;
 			goto send_msg;
 		}
@@ -447,7 +447,7 @@ i40e_pf_host_process_cmd_config_vsi_queues(struct i40e_pf_vf *vf,
 		/* Apply VF TX queue setting to HMC */
 		if (i40e_pf_host_hmc_config_txq(hw, vf, &qpair[i].txq)
 			!= I40E_SUCCESS) {
-			PMD_DRV_LOG(ERR, "Configure TX queue HMC failed");
+			PMD_DRV_LOG(ERR, "Configure TX queue HMC failed\n");
 			ret = I40E_ERR_PARAM;
 			goto send_msg;
 		}
diff --git a/lib/librte_pmd_i40e/i40e_rxtx.c b/lib/librte_pmd_i40e/i40e_rxtx.c
index f153844..d592ad6 100644
--- a/lib/librte_pmd_i40e/i40e_rxtx.c
+++ b/lib/librte_pmd_i40e/i40e_rxtx.c
@@ -507,7 +507,7 @@ i40e_xmit_cleanup(struct i40e_tx_queue *txq)
 	if (!(txd[desc_to_clean_to].cmd_type_offset_bsz &
 		rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))) {
 		PMD_TX_FREE_LOG(DEBUG, "TX descriptor %4u is not done "
-			"(port=%d queue=%d)", desc_to_clean_to,
+				"(port=%d queue=%d)\n", desc_to_clean_to,
 				txq->port_id, txq->queue_id);
 		return -1;
 	}
@@ -1219,7 +1219,7 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 		if (txq->nb_tx_used >= txq->tx_rs_thresh) {
 			PMD_TX_FREE_LOG(DEBUG,
 					"Setting RS bit on TXD id="
-					"%4u (port=%d queue=%d)",
+					"%4u (port=%d queue=%d)\n",
 					tx_last, txq->port_id, txq->queue_id);
 
 			td_cmd |= I40E_TX_DESC_CMD_RS;
@@ -1236,7 +1236,7 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 end_of_tx:
 	rte_wmb();
 
-	PMD_TX_LOG(DEBUG, "port_id=%u queue_id=%u tx_tail=%u nb_tx=%u",
+	PMD_TX_LOG(DEBUG, "port_id=%u queue_id=%u tx_tail=%u nb_tx=%u\n",
 		   (unsigned) txq->port_id, (unsigned) txq->queue_id,
 		   (unsigned) tx_id, (unsigned) nb_tx);
 
-- 
1.7.10.4

  parent reply	other threads:[~2014-08-26 14:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-26 14:09 [dpdk-dev] [PATCH 00/11] cleanup logs in main PMDs David Marchand
2014-08-26 14:09 ` [dpdk-dev] [PATCH 01/11] ixgbe: clean log messages David Marchand
2014-08-26 14:23   ` Jay Rolette
2014-08-26 14:55     ` David Marchand
2014-08-27 13:53       ` Jay Rolette
2014-08-27 18:06         ` Stephen Hemminger
2014-08-29  7:45           ` David Marchand
2014-08-26 14:09 ` [dpdk-dev] [PATCH 02/11] ixgbe: always log init messages David Marchand
2014-08-26 14:09 ` [dpdk-dev] [PATCH 03/11] ixgbe: add a message when forcing scatter mode David Marchand
2014-08-26 14:09 ` [dpdk-dev] [PATCH 04/11] ixgbe: add log messages when rx bulk mode is not usable David Marchand
2014-08-26 14:09 ` David Marchand [this message]
2014-08-26 14:09 ` [dpdk-dev] [PATCH 06/11] i40e: always log init messages David Marchand
2014-08-26 14:09 ` [dpdk-dev] [PATCH 07/11] i40e: add log messages when rx bulk mode is not usable David Marchand
2014-08-26 14:09 ` [dpdk-dev] [PATCH 08/11] e1000: clean log messages David Marchand
2014-08-26 14:09 ` [dpdk-dev] [PATCH 09/11] e1000: always log init messages David Marchand
2014-08-26 14:09 ` [dpdk-dev] [PATCH 10/11] e1000: add a message when forcing scatter mode David Marchand
2014-08-26 14:09 ` [dpdk-dev] [PATCH 11/11] eal: set log level from command line David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1409062162-19575-6-git-send-email-david.marchand@6wind.com \
    --to=david.marchand@6wind.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).