From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: dev@dpdk.org, thomas@monjalon.net, stephen@networkplumber.org,
david.marchand@redhat.com
Subject: [PATCH v3 1/3] drivers: replace printf with log macros
Date: Tue, 2 Jul 2024 18:38:54 +0530 [thread overview]
Message-ID: <20240702130856.3927348-1-hemant.agrawal@nxp.com> (raw)
In-Reply-To: <20240702104013.3813272-1-hemant.agrawal@nxp.com>
This patch replaces the printf with related log macros and functions at
various places in NXP dpaaX drivers.
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
drivers/bus/dpaa/base/fman/fman.c | 6 ++----
drivers/bus/dpaa/base/qbman/process.c | 29 +++++++++++++-------------
drivers/bus/dpaa/base/qbman/qman.c | 2 +-
drivers/bus/fslmc/fslmc_vfio.c | 2 +-
drivers/bus/fslmc/qbman/qbman_portal.c | 2 +-
drivers/crypto/caam_jr/caam_jr.c | 6 +++---
drivers/crypto/caam_jr/caam_jr_uio.c | 2 +-
drivers/net/dpaa/dpaa_ethdev.c | 6 +++---
drivers/net/dpaa/dpaa_flow.c | 8 +++----
drivers/net/dpaa/dpaa_rxtx.c | 2 +-
drivers/net/dpaa2/dpaa2_ethdev.c | 2 +-
drivers/net/dpaa2/dpaa2_tm.c | 12 +++++------
12 files changed, 39 insertions(+), 40 deletions(-)
diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c
index 1814372a40..953f7d7061 100644
--- a/drivers/bus/dpaa/base/fman/fman.c
+++ b/drivers/bus/dpaa/base/fman/fman.c
@@ -723,10 +723,8 @@ fman_finish(void)
/* release the mapping */
_errno = munmap(__if->ccsr_map, __if->regs_size);
if (unlikely(_errno < 0))
- fprintf(stderr, "%s:%d:%s(): munmap() = %d (%s)\n",
- __FILE__, __LINE__, __func__,
- -errno, strerror(errno));
- printf("Tearing down %s\n", __if->node_path);
+ FMAN_ERR(_errno, "munmap() = (%s)", strerror(errno));
+ DPAA_BUS_INFO("Tearing down %s", __if->node_path);
list_del(&__if->__if.node);
rte_free(__if);
}
diff --git a/drivers/bus/dpaa/base/qbman/process.c b/drivers/bus/dpaa/base/qbman/process.c
index 3504ec97db..59e0d641ce 100644
--- a/drivers/bus/dpaa/base/qbman/process.c
+++ b/drivers/bus/dpaa/base/qbman/process.c
@@ -13,6 +13,7 @@
#include "process.h"
#include <fsl_usd.h>
+#include "rte_dpaa_logs.h"
/* As higher-level drivers will be built on top of this (dma_mem, qbman, ...),
* it's preferable that the process driver itself not provide any exported API.
@@ -99,12 +100,12 @@ void process_release(enum dpaa_id_type id_type, uint32_t base, uint32_t num)
int ret = check_fd();
if (ret) {
- fprintf(stderr, "Process FD failure\n");
+ DPAA_BUS_ERR("Process FD failure");
return;
}
ret = ioctl(fd, DPAA_IOCTL_ID_RELEASE, &id);
if (ret)
- fprintf(stderr, "Process FD ioctl failure type %d base 0x%x num %d\n",
+ DPAA_BUS_ERR("Process FD ioctl failure type %d base 0x%x num %d",
id_type, base, num);
}
@@ -333,9 +334,9 @@ int dpaa_intr_disable(char *if_name)
ret = ioctl(fd, DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT, if_name);
if (ret) {
if (errno == EINVAL)
- printf("Failed to disable interrupt: Not Supported\n");
+ DPAA_BUS_ERR("Failed to disable interrupt: Not Supported");
else
- printf("Failed to disable interrupt\n");
+ DPAA_BUS_ERR("Failed to disable interrupt");
return ret;
}
@@ -357,7 +358,7 @@ int dpaa_get_ioctl_version_number(void)
if (errno == EINVAL) {
version_num = 1;
} else {
- printf("Failed to get ioctl version number\n");
+ DPAA_BUS_ERR("Failed to get ioctl version number");
version_num = -1;
}
}
@@ -388,7 +389,7 @@ int dpaa_get_link_status(char *if_name, struct rte_eth_link *link)
ret = ioctl(fd, DPAA_IOCTL_GET_LINK_STATUS, &args);
if (ret) {
- printf("Failed to get link status\n");
+ DPAA_BUS_ERR("Failed to get link status");
return ret;
}
@@ -404,9 +405,9 @@ int dpaa_get_link_status(char *if_name, struct rte_eth_link *link)
ret = ioctl(fd, DPAA_IOCTL_GET_LINK_STATUS_OLD, &args);
if (ret) {
if (errno == EINVAL)
- printf("Get link status: Not Supported\n");
+ DPAA_BUS_ERR("Get link status: Not Supported");
else
- printf("Failed to get link status\n");
+ DPAA_BUS_ERR("Failed to get link status");
return ret;
}
@@ -434,9 +435,9 @@ int dpaa_update_link_status(char *if_name, int link_status)
ret = ioctl(fd, DPAA_IOCTL_UPDATE_LINK_STATUS, &args);
if (ret) {
if (errno == EINVAL)
- printf("Failed to set link status: Not Supported\n");
+ DPAA_BUS_ERR("Failed to set link status: Not Supported");
else
- printf("Failed to set link status");
+ DPAA_BUS_ERR("Failed to set link status");
return ret;
}
@@ -462,9 +463,9 @@ int dpaa_update_link_speed(char *if_name, int link_speed, int link_duplex)
ret = ioctl(fd, DPAA_IOCTL_UPDATE_LINK_SPEED, &args);
if (ret) {
if (errno == EINVAL)
- printf("Failed to set link speed: Not Supported\n");
+ DPAA_BUS_ERR("Failed to set link speed: Not Supported");
else
- printf("Failed to set link speed\n");
+ DPAA_BUS_ERR("Failed to set link speed");
return ret;
}
@@ -484,9 +485,9 @@ int dpaa_restart_link_autoneg(char *if_name)
ret = ioctl(fd, DPAA_IOCTL_RESTART_LINK_AUTONEG, if_name);
if (ret) {
if (errno == EINVAL)
- printf("Failed to restart autoneg: Not Supported\n");
+ DPAA_BUS_ERR("Failed to restart autoneg: Not Supported");
else
- printf("Failed to restart autoneg\n");
+ DPAA_BUS_ERR("Failed to restart autoneg");
return ret;
}
diff --git a/drivers/bus/dpaa/base/qbman/qman.c b/drivers/bus/dpaa/base/qbman/qman.c
index 6d2fbdcf02..b1166fcb1f 100644
--- a/drivers/bus/dpaa/base/qbman/qman.c
+++ b/drivers/bus/dpaa/base/qbman/qman.c
@@ -817,7 +817,7 @@ qman_ern_poll_free(void)
fd = &swapped_msg.ern.fd;
if (unlikely(verb & 0x20)) {
- printf("HW ERN notification, Nothing to do\n");
+ pr_warn("HW ERN notification, Nothing to do\n");
} else {
if ((fd->bpid & 0xff) != 0xff)
qman_free_mbuf_cb(fd);
diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 5966776a85..9b50dca101 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -395,7 +395,7 @@ rte_fslmc_vfio_mem_dmamap(uint64_t vaddr, uint64_t iova, uint64_t size)
ret = ioctl(group->container->fd, VFIO_IOMMU_MAP_DMA,
&dma_map);
if (ret) {
- printf("Unable to map DMA address (errno = %d)\n",
+ DPAA2_BUS_ERR("Unable to map DMA address (errno = %d)",
errno);
return ret;
}
diff --git a/drivers/bus/fslmc/qbman/qbman_portal.c b/drivers/bus/fslmc/qbman/qbman_portal.c
index 3a7579c8a7..1f24cdce7e 100644
--- a/drivers/bus/fslmc/qbman/qbman_portal.c
+++ b/drivers/bus/fslmc/qbman/qbman_portal.c
@@ -1879,7 +1879,7 @@ void qbman_pull_desc_set_rad(struct qbman_pull_desc *d, int rad)
else
d->pull.verb &= ~(1 << QB_VDQCR_VERB_RAD_SHIFT);
} else {
- printf("The RAD feature is not valid when RLS = 0\n");
+ pr_warn("The RAD feature is not valid when RLS = 0\n");
}
}
diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c
index 0fa70c978f..fb9ac9cb30 100644
--- a/drivers/crypto/caam_jr/caam_jr.c
+++ b/drivers/crypto/caam_jr/caam_jr.c
@@ -461,7 +461,7 @@ caam_jr_prep_cdb(struct caam_jr_session *ses)
}
#if CAAM_JR_DBG
- SEC_DUMP_DESC(cdb->sh_desc);
+ SEC_DUMP_DESC(cdb->sh_desc, stdout);
#endif
cdb->sh_hdr.hi.field.idlen = shared_desc_len;
@@ -587,8 +587,8 @@ hw_poll_job_ring(struct sec_job_ring_t *job_ring,
/* todo check if it is false alarm no desc present */
if (!current_desc_addr) {
false_alarm++;
- printf("false alarm %" PRIu64 "real %" PRIu64
- " sec_err =0x%x cidx Index =0%d\n",
+ CAAM_JR_ERR("false alarm %" PRIu64 "real %" PRIu64
+ " sec_err =0x%x cidx Index =0%d",
false_alarm, real_poll,
sec_error_code, job_ring->cidx);
rte_panic("CAAM JR descriptor NULL");
diff --git a/drivers/crypto/caam_jr/caam_jr_uio.c b/drivers/crypto/caam_jr/caam_jr_uio.c
index 583ba3b523..0dcf971a15 100644
--- a/drivers/crypto/caam_jr/caam_jr_uio.c
+++ b/drivers/crypto/caam_jr/caam_jr_uio.c
@@ -418,7 +418,7 @@ sec_configure(void)
d = opendir(SEC_UIO_DEVICE_SYS_ATTR_PATH);
if (d == NULL) {
- printf("\nError opening directory '%s': %s\n",
+ CAAM_JR_ERR("Error opening directory '%s': %s",
SEC_UIO_DEVICE_SYS_ATTR_PATH, strerror(errno));
return -1;
}
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index 935a4f2ada..bcd19f31fb 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -282,9 +282,9 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
dpaa_interrupt_handler,
(void *)dev);
if (ret == EINVAL)
- printf("Failed to enable interrupt: Not Supported\n");
+ DPAA_PMD_ERR("Failed to enable interrupt: Not Supported\n");
else
- printf("Failed to enable interrupt\n");
+ DPAA_PMD_ERR("Failed to enable interrupt\n");
}
dev->data->dev_conf.intr_conf.lsc = 0;
dev->data->dev_flags &= ~RTE_ETH_DEV_INTR_LSC;
@@ -340,7 +340,7 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
dpaa_update_link_speed(__fif->node_name, speed, duplex);
} else {
/* Manual autoneg - custom advertisement speed. */
- printf("Custom Advertisement speeds not supported\n");
+ DPAA_PMD_ERR("Custom Advertisement speeds not supported\n");
}
}
diff --git a/drivers/net/dpaa/dpaa_flow.c b/drivers/net/dpaa/dpaa_flow.c
index 690ba6bcb3..b78477a59a 100644
--- a/drivers/net/dpaa/dpaa_flow.c
+++ b/drivers/net/dpaa/dpaa_flow.c
@@ -68,7 +68,7 @@ static void fm_prev_cleanup(void)
fm_info.fman_handle = fm_open(fman_id);
if (!fm_info.fman_handle) {
- printf("\n%s- unable to open FMAN", __func__);
+ DPAA_PMD_ERR("unable to open FMAN");
return;
}
@@ -78,7 +78,7 @@ static void fm_prev_cleanup(void)
/* FM PCD Open */
fm_info.pcd_handle = fm_pcd_open(&fm_pcd_params);
if (!fm_info.pcd_handle) {
- printf("\n%s- unable to open PCD", __func__);
+ DPAA_PMD_ERR("unable to open PCD");
return;
}
@@ -108,11 +108,11 @@ static void fm_prev_cleanup(void)
continue;
if (dpaa_fm_deconfig(&dpaa_intf, NULL))
- printf("\nDPAA FM deconfig failed\n");
+ DPAA_PMD_ERR("DPAA FM deconfig failed");
}
if (dpaa_fm_term())
- printf("\nDPAA FM term failed\n");
+ DPAA_PMD_ERR("DPAA FM term failed");
memset(&fm_model, 0, sizeof(struct dpaa_fm_model));
}
diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c
index ce4f3d6c85..c2579d65ee 100644
--- a/drivers/net/dpaa/dpaa_rxtx.c
+++ b/drivers/net/dpaa/dpaa_rxtx.c
@@ -103,7 +103,7 @@ static void dpaa_display_frame_info(const struct qm_fd *fd,
for (ii = 0; ii < fd->length20; ii++) {
DISPLAY_PRINT("%02x ", ptr[ii]);
if (((ii + 1) % 16) == 0)
- printf("\n");
+ DISPLAY_PRINT("\n");
}
DISPLAY_PRINT("\n");
}
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 97edc00420..449bbda7ca 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -2694,7 +2694,7 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
priv->max_vlan_filters = attr.vlan_filter_entries;
priv->flags = 0;
#if defined(RTE_LIBRTE_IEEE1588)
- printf("DPDK IEEE1588 is enabled\n");
+ DPAA2_PMD_INFO("DPDK IEEE1588 is enabled");
priv->flags |= DPAA2_TX_CONF_ENABLE;
#endif
/* Used with ``fslmc:dpni.1,drv_tx_conf=1`` */
diff --git a/drivers/net/dpaa2/dpaa2_tm.c b/drivers/net/dpaa2/dpaa2_tm.c
index 8fe5bfa013..cb854964b4 100644
--- a/drivers/net/dpaa2/dpaa2_tm.c
+++ b/drivers/net/dpaa2/dpaa2_tm.c
@@ -499,7 +499,7 @@ dpaa2_node_add(struct rte_eth_dev *dev, uint32_t node_id,
node->channel_id = priv->channel_inuse;
priv->channel_inuse++;
} else {
- printf("error no channel id available\n");
+ DPAA2_PMD_ERR("error no channel id available");
}
}
@@ -580,7 +580,7 @@ dpaa2_tm_configure_queue(struct rte_eth_dev *dev, struct dpaa2_tm_node *node)
flow_id = 0;
if (dpaa2_q == NULL) {
- printf("Queue is not configured for node = %d\n", node->id);
+ DPAA2_PMD_ERR("Queue is not configured for node = %d", node->id);
return -1;
}
@@ -590,9 +590,9 @@ dpaa2_tm_configure_queue(struct rte_eth_dev *dev, struct dpaa2_tm_node *node)
((node->parent->channel_id << 8) | tc_id),
flow_id, options, &tx_flow_cfg);
if (ret) {
- printf("Error in setting the tx flow: "
+ DPAA2_PMD_ERR("Error in setting the tx flow: "
"channel id = %d tc_id= %d, param = 0x%x "
- "flow=%d err=%d\n", node->parent->channel_id, tc_id,
+ "flow=%d err=%d", node->parent->channel_id, tc_id,
((node->parent->channel_id << 8) | tc_id), flow_id,
ret);
return -1;
@@ -605,7 +605,7 @@ dpaa2_tm_configure_queue(struct rte_eth_dev *dev, struct dpaa2_tm_node *node)
DPNI_QUEUE_TX, ((node->parent->channel_id << 8) | dpaa2_q->tc_index),
dpaa2_q->flow_id, &tx_flow_cfg, &qid);
if (ret) {
- printf("Error in getting LFQID err=%d", ret);
+ DPAA2_PMD_ERR("Error in getting LFQID err=%d", ret);
return -1;
}
dpaa2_q->fqid = qid.fqid;
@@ -636,7 +636,7 @@ dpaa2_tm_configure_queue(struct rte_eth_dev *dev, struct dpaa2_tm_node *node)
((node->parent->channel_id << 8) | tc_id),
&cong_notif_cfg);
if (ret) {
- printf("Error in setting tx congestion notification: "
+ DPAA2_PMD_ERR("Error in setting tx congestion notification: "
"err=%d", ret);
return -ret;
}
--
2.25.1
next prev parent reply other threads:[~2024-07-02 13:09 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-15 10:29 [PATCH 1/2] " Hemant Agrawal
2023-02-15 10:29 ` [PATCH 2/2] drivers: replace printf with fprintf for debug functions Hemant Agrawal
2023-02-15 15:16 ` Thomas Monjalon
2023-02-16 9:27 ` Hemant Agrawal
2024-07-02 9:31 ` David Marchand
2024-07-02 9:59 ` Hemant Agrawal
2023-02-15 17:17 ` Stephen Hemminger
2024-07-02 10:40 ` [PATCH v2 1/2] drivers: replace printf with log macros Hemant Agrawal
2024-07-02 10:40 ` [PATCH v2 2/2] drivers: replace printf with fprintf for debug functions Hemant Agrawal
2024-07-02 15:11 ` Stephen Hemminger
2024-07-02 17:26 ` Hemant Agrawal
2024-07-02 12:15 ` [PATCH v2 1/2] drivers: replace printf with log macros David Marchand
2024-07-02 13:08 ` Hemant Agrawal [this message]
2024-07-02 13:08 ` [PATCH v3 2/3] bus/dpaa: remove double newline Hemant Agrawal
2024-07-02 13:08 ` [PATCH v3 3/3] drivers: replace printf with fprintf for debug functions Hemant Agrawal
2024-07-03 10:41 ` [PATCH v3 1/3] drivers: replace printf with log macros David Marchand
2024-07-03 12:02 ` Hemant Agrawal
2024-07-03 12:11 ` David Marchand
2024-07-03 12:16 ` [PATCH v4 " Hemant Agrawal
2024-07-03 12:16 ` [PATCH v4 2/3] drivers: dpaa: remove double newline Hemant Agrawal
2024-07-03 12:16 ` [PATCH v4 3/3] drivers: replace printf with fprintf for debug functions Hemant Agrawal
2024-07-03 14:54 ` [PATCH v4 1/3] drivers: replace printf with log macros 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=20240702130856.3927348-1-hemant.agrawal@nxp.com \
--to=hemant.agrawal@nxp.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
/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).