* [PATCH 1/2] drivers: replace printf with log macros @ 2023-02-15 10:29 Hemant Agrawal 2023-02-15 10:29 ` [PATCH 2/2] drivers: replace printf with fprintf for debug functions Hemant Agrawal 2024-07-02 10:40 ` [PATCH v2 1/2] drivers: replace printf with log macros Hemant Agrawal 0 siblings, 2 replies; 22+ messages in thread From: Hemant Agrawal @ 2023-02-15 10:29 UTC (permalink / raw) To: dev, thomas 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 | 8 +++---- 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 | 2 +- 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 | 10 ++++----- 12 files changed, 37 insertions(+), 38 deletions(-) diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c index 1814372a40..2fc1e64f36 100644 --- a/drivers/bus/dpaa/base/fman/fman.c +++ b/drivers/bus/dpaa/base/fman/fman.c @@ -425,7 +425,7 @@ fman_if_init(const struct device_node *dpa_node) char_prop = of_get_property(mac_node, "phy-connection-type", NULL); if (!char_prop) { - printf("memac: unknown MII type assuming 1G\n"); + FMAN_ERR(-EINVAL, "memac: unknown MII type assuming 1G\n"); /* Right now forcing memac to 1g in case of error*/ __if->__if.mac_type = fman_mac_1g; } else { @@ -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)\n", strerror(errno)); + DPAA_BUS_INFO("Tearing down %s\n", __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..af1e459641 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\n"); 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\n", 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\n"); else - printf("Failed to disable interrupt\n"); + DPAA_BUS_ERR("Failed to disable interrupt\n"); 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\n"); 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\n"); 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\n"); else - printf("Failed to get link status\n"); + DPAA_BUS_ERR("Failed to get link status\n"); 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\n"); 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\n"); else - printf("Failed to set link speed\n"); + DPAA_BUS_ERR("Failed to set link speed\n"); 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\n"); else - printf("Failed to restart autoneg\n"); + DPAA_BUS_ERR("Failed to restart autoneg\n"); return ret; } diff --git a/drivers/bus/dpaa/base/qbman/qman.c b/drivers/bus/dpaa/base/qbman/qman.c index 3949bf8712..95c796c4b8 100644 --- a/drivers/bus/dpaa/base/qbman/qman.c +++ b/drivers/bus/dpaa/base/qbman/qman.c @@ -818,7 +818,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..da0669d554 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)\n", 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 b55258689b..9373cee57d 100644 --- a/drivers/crypto/caam_jr/caam_jr.c +++ b/drivers/crypto/caam_jr/caam_jr.c @@ -587,7 +587,7 @@ 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 + CAAM_JR_ERR("false alarm %" PRIu64 "real %" PRIu64 " sec_err =0x%x cidx Index =0%d\n", false_alarm, real_poll, sec_error_code, job_ring->cidx); diff --git a/drivers/crypto/caam_jr/caam_jr_uio.c b/drivers/crypto/caam_jr/caam_jr_uio.c index 583ba3b523..586beceb14 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\n", 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 a6c86113d1..59bcebd62f 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..5c75f4220e 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\n"); } if (dpaa_fm_term()) - printf("\nDPAA FM term failed\n"); + DPAA_PMD_ERR("DPAA FM term failed\n"); 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 679f33ae1a..6f79f20d12 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -2682,7 +2682,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\n"); 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..cd6739dcfa 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\n"); } } @@ -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\n", node->id); return -1; } @@ -590,7 +590,7 @@ 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, ((node->parent->channel_id << 8) | tc_id), flow_id, @@ -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.17.1 ^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 2/2] drivers: replace printf with fprintf for debug functions 2023-02-15 10:29 [PATCH 1/2] drivers: replace printf with log macros Hemant Agrawal @ 2023-02-15 10:29 ` Hemant Agrawal 2023-02-15 15:16 ` Thomas Monjalon 2023-02-15 17:17 ` Stephen Hemminger 2024-07-02 10:40 ` [PATCH v2 1/2] drivers: replace printf with log macros Hemant Agrawal 1 sibling, 2 replies; 22+ messages in thread From: Hemant Agrawal @ 2023-02-15 10:29 UTC (permalink / raw) To: dev, thomas This patch replaces simple printf with fprintf for debug dump related functions for various NXP dpaaX related drivers. Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com> --- drivers/bus/dpaa/base/fman/netcfg_layer.c | 20 ++++---- drivers/crypto/caam_jr/caam_jr.c | 4 +- drivers/crypto/caam_jr/caam_jr_desc.h | 2 +- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 20 ++++---- drivers/crypto/dpaa_sec/dpaa_sec.c | 52 ++++++++++----------- drivers/net/dpaa2/dpaa2_flow.c | 40 ++++++++-------- 6 files changed, 69 insertions(+), 69 deletions(-) diff --git a/drivers/bus/dpaa/base/fman/netcfg_layer.c b/drivers/bus/dpaa/base/fman/netcfg_layer.c index 6a405c984d..69cee08fb9 100644 --- a/drivers/bus/dpaa/base/fman/netcfg_layer.c +++ b/drivers/bus/dpaa/base/fman/netcfg_layer.c @@ -33,33 +33,33 @@ dump_netcfg(struct netcfg_info *cfg_ptr) { int i; - printf(".......... DPAA Configuration ..........\n\n"); + fprintf(stdout, ".......... DPAA Configuration ..........\n\n"); /* Network interfaces */ - printf("Network interfaces: %d\n", cfg_ptr->num_ethports); + fprintf(stdout, "Network interfaces: %d\n", cfg_ptr->num_ethports); for (i = 0; i < cfg_ptr->num_ethports; i++) { struct fman_if_bpool *bpool; struct fm_eth_port_cfg *p_cfg = &cfg_ptr->port_cfg[i]; struct fman_if *__if = p_cfg->fman_if; - printf("\n+ Fman %d, MAC %d (%s);\n", + fprintf(stdout, "\n+ Fman %d, MAC %d (%s);\n", __if->fman_idx, __if->mac_idx, (__if->mac_type == fman_mac_1g) ? "1G" : (__if->mac_type == fman_mac_2_5g) ? "2.5G" : "10G"); - printf("\tmac_addr: " RTE_ETHER_ADDR_PRT_FMT "\n", + fprintf(stdout, "\tmac_addr: " RTE_ETHER_ADDR_PRT_FMT "\n", RTE_ETHER_ADDR_BYTES(&__if->mac_addr)); - printf("\ttx_channel_id: 0x%02x\n", + fprintf(stdout, "\ttx_channel_id: 0x%02x\n", __if->tx_channel_id); - printf("\tfqid_rx_def: 0x%x\n", p_cfg->rx_def); - printf("\tfqid_rx_err: 0x%x\n", __if->fqid_rx_err); + fprintf(stdout, "\tfqid_rx_def: 0x%x\n", p_cfg->rx_def); + fprintf(stdout, "\tfqid_rx_err: 0x%x\n", __if->fqid_rx_err); - printf("\tfqid_tx_err: 0x%x\n", __if->fqid_tx_err); - printf("\tfqid_tx_confirm: 0x%x\n", __if->fqid_tx_confirm); + fprintf(stdout, "\tfqid_tx_err: 0x%x\n", __if->fqid_tx_err); + fprintf(stdout, "\tfqid_tx_confirm: 0x%x\n", __if->fqid_tx_confirm); fman_if_for_each_bpool(bpool, __if) - printf("\tbuffer pool: (bpid=%d, count=%"PRId64 + fprintf(stdout, "\tbuffer pool: (bpid=%d, count=%"PRId64 " size=%"PRId64", addr=0x%"PRIx64")\n", bpool->bpid, bpool->count, bpool->size, bpool->addr); diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c index 9373cee57d..d19738b7bf 100644 --- a/drivers/crypto/caam_jr/caam_jr.c +++ b/drivers/crypto/caam_jr/caam_jr.c @@ -1410,9 +1410,9 @@ caam_jr_enqueue_op(struct rte_crypto_op *op, struct caam_jr_qp *qp) rte_pktmbuf_mtod(op->sym->m_src, void *), rte_pktmbuf_data_len(op->sym->m_src)); - printf("\n JD before conversion\n"); + fprintf(stdout, "\n JD before conversion\n"); for (i = 0; i < 12; i++) - printf("\n 0x%08x", ctx->jobdes.desc[i]); + fprintf(stdout, "\n 0x%08x", ctx->jobdes.desc[i]); #endif CAAM_JR_DP_DEBUG("Jr[%p] pi[%d] ci[%d].Before sending desc", diff --git a/drivers/crypto/caam_jr/caam_jr_desc.h b/drivers/crypto/caam_jr/caam_jr_desc.h index 135d51c392..1b6a8f9efa 100644 --- a/drivers/crypto/caam_jr/caam_jr_desc.h +++ b/drivers/crypto/caam_jr/caam_jr_desc.h @@ -116,7 +116,7 @@ for (__i = 0; \ __i < SEC_GET_DESC_LEN(descriptor); \ __i++) { \ - printf("0x%08x: 0x%08x\n", \ + fprintf(stdout, "0x%08x: 0x%08x\n", \ (uint32_t)(((uint32_t *)(descriptor)) + __i), \ *(((uint32_t *)(descriptor)) + __i)); \ } \ diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c index c25e40030b..c707666f35 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -1685,7 +1685,7 @@ dpaa2_sec_dump(struct rte_crypto_op *op) goto mbuf_dump; priv = (struct ctxt_priv *)sess->ctxt; - printf("\n****************************************\n" + fprintf(stdout, "\n****************************************\n" "session params:\n\tContext type:\t%d\n\tDirection:\t%s\n" "\tCipher alg:\t%d\n\tAuth alg:\t%d\n\tAead alg:\t%d\n" "\tCipher key len:\t%zd\n", sess->ctxt_type, @@ -1696,7 +1696,7 @@ dpaa2_sec_dump(struct rte_crypto_op *op) sess->cipher_key.length); rte_hexdump(stdout, "auth key", sess->auth_key.data, sess->auth_key.length); - printf("\tAuth key len:\t%zd\n\tIV len:\t\t%d\n\tIV offset:\t%d\n" + fprintf(stdout, "\tAuth key len:\t%zd\n\tIV len:\t\t%d\n\tIV offset:\t%d\n" "\tdigest length:\t%d\n\tstatus:\t\t%d\n\taead auth only" " len:\t%d\n\taead cipher text:\t%d\n", sess->auth_key.length, sess->iv.length, sess->iv.offset, @@ -1704,7 +1704,7 @@ dpaa2_sec_dump(struct rte_crypto_op *op) sess->ext_params.aead_ctxt.auth_only_len, sess->ext_params.aead_ctxt.auth_cipher_text); #ifdef RTE_LIBRTE_SECURITY - printf("PDCP session params:\n" + fprintf(stdout, "PDCP session params:\n" "\tDomain:\t\t%d\n\tBearer:\t\t%d\n\tpkt_dir:\t%d\n\thfn_ovd:" "\t%d\n\tsn_size:\t%d\n\thfn_ovd_offset:\t%d\n\thfn:\t\t%d\n" "\thfn_threshold:\t0x%x\n", sess->pdcp.domain, @@ -1714,29 +1714,29 @@ dpaa2_sec_dump(struct rte_crypto_op *op) #endif bufsize = (uint8_t)priv->flc_desc[0].flc.word1_sdl; - printf("Descriptor Dump:\n"); + fprintf(stdout, "Descriptor Dump:\n"); for (i = 0; i < bufsize; i++) - printf("\tDESC[%d]:0x%x\n", i, priv->flc_desc[0].desc[i]); + fprintf(stdout, "\tDESC[%d]:0x%x\n", i, priv->flc_desc[0].desc[i]); - printf("\n"); + fprintf(stdout, "\n"); mbuf_dump: sym_op = op->sym; if (sym_op->m_src) { - printf("Source mbuf:\n"); + fprintf(stdout, "Source mbuf:\n"); rte_pktmbuf_dump(stdout, sym_op->m_src, sym_op->m_src->data_len); } if (sym_op->m_dst) { - printf("Destination mbuf:\n"); + fprintf(stdout, "Destination mbuf:\n"); rte_pktmbuf_dump(stdout, sym_op->m_dst, sym_op->m_dst->data_len); } - printf("Session address = %p\ncipher offset: %d, length: %d\n" + fprintf(stdout, "Session address = %p\ncipher offset: %d, length: %d\n" "auth offset: %d, length: %d\n aead offset: %d, length: %d\n" , sym_op->session, sym_op->cipher.data.offset, sym_op->cipher.data.length, sym_op->auth.data.offset, sym_op->auth.data.length, sym_op->aead.data.offset, sym_op->aead.data.length); - printf("\n"); + fprintf(stdout, "\n"); } diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c index db52683847..0a47c5c8ad 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.c +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c @@ -676,16 +676,16 @@ dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp) sess = SECURITY_GET_SESS_PRIV(op->sym->session); #endif if (sess == NULL) { - printf("session is NULL\n"); + fprintf(stdout, "session is NULL\n"); goto mbuf_dump; } cdb = &sess->cdb; rte_memcpy(&c_cdb, cdb, sizeof(struct sec_cdb)); #ifdef RTE_LIBRTE_SECURITY - printf("\nsession protocol type = %d\n", sess->proto_alg); + fprintf(stdout, "\nsession protocol type = %d\n", sess->proto_alg); #endif - printf("\n****************************************\n" + fprintf(stdout, "\n****************************************\n" "session params:\n\tContext type:\t%d\n\tDirection:\t%s\n" "\tCipher alg:\t%d\n\tAuth alg:\t%d\n\tAead alg:\t%d\n" "\tCipher key len:\t%"PRIu64"\n\tCipher alg:\t%d\n" @@ -698,7 +698,7 @@ dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp) sess->cipher_key.length); rte_hexdump(stdout, "auth key", sess->auth_key.data, sess->auth_key.length); - printf("\tAuth key len:\t%"PRIu64"\n\tAuth alg:\t%d\n" + fprintf(stdout, "\tAuth key len:\t%"PRIu64"\n\tAuth alg:\t%d\n" "\tAuth algmode:\t%d\n\tIV len:\t\t%d\n\tIV offset:\t%d\n" "\tdigest length:\t%d\n\tauth only len:\t\t%d\n" "\taead cipher text:\t%d\n", @@ -708,7 +708,7 @@ dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp) sess->digest_length, sess->auth_only_len, sess->auth_cipher_text); #ifdef RTE_LIBRTE_SECURITY - printf("PDCP session params:\n" + fprintf(stdout, "PDCP session params:\n" "\tDomain:\t\t%d\n\tBearer:\t\t%d\n\tpkt_dir:\t%d\n\thfn_ovd:" "\t%d\n\tsn_size:\t%d\n\tsdap_enabled:\t%d\n\thfn_ovd_offset:" "\t%d\n\thfn:\t\t%d\n" @@ -722,63 +722,63 @@ dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp) c_cdb.sh_hdr.lo.word = rte_be_to_cpu_32(c_cdb.sh_hdr.lo.word); bufsize = c_cdb.sh_hdr.hi.field.idlen; - printf("cdb = %p\n\n", cdb); - printf("Descriptor size = %d\n", bufsize); + fprintf(stdout, "cdb = %p\n\n", cdb); + fprintf(stdout, "Descriptor size = %d\n", bufsize); int m; for (m = 0; m < bufsize; m++) - printf("0x%x\n", rte_be_to_cpu_32(c_cdb.sh_desc[m])); + fprintf(stdout, "0x%x\n", rte_be_to_cpu_32(c_cdb.sh_desc[m])); - printf("\n"); + fprintf(stdout, "\n"); mbuf_dump: sym_op = op->sym; if (sym_op->m_src) { - printf("Source mbuf:\n"); + fprintf(stdout, "Source mbuf:\n"); rte_pktmbuf_dump(stdout, sym_op->m_src, sym_op->m_src->data_len); } if (sym_op->m_dst) { - printf("Destination mbuf:\n"); + fprintf(stdout, "Destination mbuf:\n"); rte_pktmbuf_dump(stdout, sym_op->m_dst, sym_op->m_dst->data_len); } - printf("Session address = %p\ncipher offset: %d, length: %d\n" + fprintf(stdout, "Session address = %p\ncipher offset: %d, length: %d\n" "auth offset: %d, length: %d\n aead offset: %d, length: %d\n", sym_op->session, sym_op->cipher.data.offset, sym_op->cipher.data.length, sym_op->auth.data.offset, sym_op->auth.data.length, sym_op->aead.data.offset, sym_op->aead.data.length); - printf("\n"); + fprintf(stdout, "\n"); - printf("******************************************************\n"); - printf("ctx info:\n"); - printf("job->sg[0] output info:\n"); + fprintf(stdout, "******************************************************\n"); + fprintf(stdout, "ctx info:\n"); + fprintf(stdout, "job->sg[0] output info:\n"); memcpy(&sg[0], &job->sg[0], sizeof(sg[0])); - printf("\taddr = %"PRIx64",\n\tlen = %d,\n\tfinal = %d,\n\textension = %d" + fprintf(stdout, "\taddr = %"PRIx64",\n\tlen = %d,\n\tfinal = %d,\n\textension = %d" "\n\tbpid = %d\n\toffset = %d\n", (uint64_t)sg[0].addr, sg[0].length, sg[0].final, sg[0].extension, sg[0].bpid, sg[0].offset); - printf("\njob->sg[1] input info:\n"); + fprintf(stdout, "\njob->sg[1] input info:\n"); memcpy(&sg[1], &job->sg[1], sizeof(sg[1])); hw_sg_to_cpu(&sg[1]); - printf("\taddr = %"PRIx64",\n\tlen = %d,\n\tfinal = %d,\n\textension = %d" + fprintf(stdout, "\taddr = %"PRIx64",\n\tlen = %d,\n\tfinal = %d,\n\textension = %d" "\n\tbpid = %d\n\toffset = %d\n", (uint64_t)sg[1].addr, sg[1].length, sg[1].final, sg[1].extension, sg[1].bpid, sg[1].offset); - printf("\nctx pool addr = %p\n", ctx->ctx_pool); + fprintf(stdout, "\nctx pool addr = %p\n", ctx->ctx_pool); if (ctx->ctx_pool) - printf("ctx pool available counts = %d\n", + fprintf(stdout, "ctx pool available counts = %d\n", rte_mempool_avail_count(ctx->ctx_pool)); - printf("\nop pool addr = %p\n", op->mempool); + fprintf(stdout, "\nop pool addr = %p\n", op->mempool); if (op->mempool) - printf("op pool available counts = %d\n", + fprintf(stdout, "op pool available counts = %d\n", rte_mempool_avail_count(op->mempool)); - printf("********************************************************\n"); - printf("Queue data:\n"); - printf("\tFQID = 0x%x\n\tstate = %d\n\tnb_desc = %d\n" + fprintf(stdout, "********************************************************\n"); + fprintf(stdout, "Queue data:\n"); + fprintf(stdout, "\tFQID = 0x%x\n\tstate = %d\n\tnb_desc = %d\n" "\tctx_pool = %p\n\trx_pkts = %d\n\ttx_pkts" "= %d\n\trx_errs = %d\n\ttx_errs = %d\n\n", qp->outq.fqid, qp->outq.state, qp->outq.nb_desc, diff --git a/drivers/net/dpaa2/dpaa2_flow.c b/drivers/net/dpaa2/dpaa2_flow.c index df06c3862e..4d9fad1596 100644 --- a/drivers/net/dpaa2/dpaa2_flow.c +++ b/drivers/net/dpaa2/dpaa2_flow.c @@ -244,7 +244,7 @@ static inline void dpaa2_flow_qos_table_extracts_log( if (!dpaa2_flow_control_log) return; - printf("Setup QoS table: number of extracts: %d\r\n", + fprintf(stdout, "Setup QoS table: number of extracts: %d\r\n", priv->extract.qos_key_extract.dpkg.num_extracts); for (idx = 0; idx < priv->extract.qos_key_extract.dpkg.num_extracts; idx++) { @@ -253,11 +253,11 @@ static inline void dpaa2_flow_qos_table_extracts_log( priv->extract.qos_key_extract.dpkg.extracts[idx] .extract.from_hdr.field, string); - printf("%s", string); + fprintf(stdout, "%s", string); if ((idx + 1) < priv->extract.qos_key_extract.dpkg.num_extracts) - printf(" / "); + fprintf(stdout, " / "); } - printf("\r\n"); + fprintf(stdout, "\r\n"); } static inline void dpaa2_flow_fs_table_extracts_log( @@ -269,7 +269,7 @@ static inline void dpaa2_flow_fs_table_extracts_log( if (!dpaa2_flow_control_log) return; - printf("Setup FS table: number of extracts of TC[%d]: %d\r\n", + fprintf(stdout, "Setup FS table: number of extracts of TC[%d]: %d\r\n", tc_id, priv->extract.tc_key_extract[tc_id] .dpkg.num_extracts); for (idx = 0; idx < priv->extract.tc_key_extract[tc_id] @@ -279,12 +279,12 @@ static inline void dpaa2_flow_fs_table_extracts_log( priv->extract.tc_key_extract[tc_id].dpkg.extracts[idx] .extract.from_hdr.field, string); - printf("%s", string); + fprintf(stdout, "%s", string); if ((idx + 1) < priv->extract.tc_key_extract[tc_id] .dpkg.num_extracts) - printf(" / "); + fprintf(stdout, " / "); } - printf("\r\n"); + fprintf(stdout, "\r\n"); } static inline void dpaa2_flow_qos_entry_log( @@ -296,21 +296,21 @@ static inline void dpaa2_flow_qos_entry_log( if (!dpaa2_flow_control_log) return; - printf("\r\n%s QoS entry[%d] for TC[%d], extracts size is %d\r\n", + fprintf(stdout, "\r\n%s QoS entry[%d] for TC[%d], extracts size is %d\r\n", log_info, qos_index, flow->tc_id, flow->qos_real_key_size); key = (uint8_t *)(size_t)flow->qos_rule.key_iova; mask = (uint8_t *)(size_t)flow->qos_rule.mask_iova; - printf("key:\r\n"); + fprintf(stdout, "key:\r\n"); for (idx = 0; idx < flow->qos_real_key_size; idx++) - printf("%02x ", key[idx]); + fprintf(stdout, "%02x ", key[idx]); - printf("\r\nmask:\r\n"); + fprintf(stdout, "\r\nmask:\r\n"); for (idx = 0; idx < flow->qos_real_key_size; idx++) - printf("%02x ", mask[idx]); + fprintf(stdout, "%02x ", mask[idx]); - printf("\r\n%s QoS ipsrc: %d, ipdst: %d\r\n", log_info, + fprintf(stdout, "\r\n%s QoS ipsrc: %d, ipdst: %d\r\n", log_info, flow->ipaddr_rule.qos_ipsrc_offset, flow->ipaddr_rule.qos_ipdst_offset); } @@ -324,21 +324,21 @@ static inline void dpaa2_flow_fs_entry_log( if (!dpaa2_flow_control_log) return; - printf("\r\n%s FS/TC entry[%d] of TC[%d], extracts size is %d\r\n", + fprintf(stdout, "\r\n%s FS/TC entry[%d] of TC[%d], extracts size is %d\r\n", log_info, flow->tc_index, flow->tc_id, flow->fs_real_key_size); key = (uint8_t *)(size_t)flow->fs_rule.key_iova; mask = (uint8_t *)(size_t)flow->fs_rule.mask_iova; - printf("key:\r\n"); + fprintf(stdout, "key:\r\n"); for (idx = 0; idx < flow->fs_real_key_size; idx++) - printf("%02x ", key[idx]); + fprintf(stdout, "%02x ", key[idx]); - printf("\r\nmask:\r\n"); + fprintf(stdout, "\r\nmask:\r\n"); for (idx = 0; idx < flow->fs_real_key_size; idx++) - printf("%02x ", mask[idx]); + fprintf(stdout, "%02x ", mask[idx]); - printf("\r\n%s FS ipsrc: %d, ipdst: %d\r\n", log_info, + fprintf(stdout, "\r\n%s FS ipsrc: %d, ipdst: %d\r\n", log_info, flow->ipaddr_rule.fs_ipsrc_offset, flow->ipaddr_rule.fs_ipdst_offset); } -- 2.17.1 ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/2] drivers: replace printf with fprintf for debug functions 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 2023-02-15 17:17 ` Stephen Hemminger 1 sibling, 1 reply; 22+ messages in thread From: Thomas Monjalon @ 2023-02-15 15:16 UTC (permalink / raw) To: Hemant Agrawal; +Cc: dev 15/02/2023 11:29, Hemant Agrawal: > This patch replaces simple printf with fprintf for debug dump > related functions for various NXP dpaaX related drivers. Why replacing with fprintf(stdout)? Would it be better to provide a FILE* parameter to the functions? ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/2] drivers: replace printf with fprintf for debug functions 2023-02-15 15:16 ` Thomas Monjalon @ 2023-02-16 9:27 ` Hemant Agrawal 2024-07-02 9:31 ` David Marchand 0 siblings, 1 reply; 22+ messages in thread From: Hemant Agrawal @ 2023-02-16 9:27 UTC (permalink / raw) To: Thomas Monjalon, Hemant Agrawal; +Cc: dev On 15-Feb-23 8:46 PM, Thomas Monjalon wrote: > 15/02/2023 11:29, Hemant Agrawal: >> This patch replaces simple printf with fprintf for debug dump >> related functions for various NXP dpaaX related drivers. > Why replacing with fprintf(stdout)? > > Would it be better to provide a FILE* parameter to the functions? yes, I will update. > > > ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/2] drivers: replace printf with fprintf for debug functions 2023-02-16 9:27 ` Hemant Agrawal @ 2024-07-02 9:31 ` David Marchand 2024-07-02 9:59 ` Hemant Agrawal 0 siblings, 1 reply; 22+ messages in thread From: David Marchand @ 2024-07-02 9:31 UTC (permalink / raw) To: hemant.agrawal; +Cc: Thomas Monjalon, dev Hello Hemant, On Thu, Feb 16, 2023 at 10:28 AM Hemant Agrawal <hemant.agrawal@oss.nxp.com> wrote: > On 15-Feb-23 8:46 PM, Thomas Monjalon wrote: > > 15/02/2023 11:29, Hemant Agrawal: > >> This patch replaces simple printf with fprintf for debug dump > >> related functions for various NXP dpaaX related drivers. > > Why replacing with fprintf(stdout)? > > > > Would it be better to provide a FILE* parameter to the functions? > yes, I will update. Any news for this series? At least a rebase is needed, I marked it as changes requested. -- David Marchand ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/2] drivers: replace printf with fprintf for debug functions 2024-07-02 9:31 ` David Marchand @ 2024-07-02 9:59 ` Hemant Agrawal 0 siblings, 0 replies; 22+ messages in thread From: Hemant Agrawal @ 2024-07-02 9:59 UTC (permalink / raw) To: David Marchand, hemant.agrawal; +Cc: Thomas Monjalon, dev On 02-07-2024 15:01, David Marchand wrote: > Hello Hemant, > > On Thu, Feb 16, 2023 at 10:28 AM Hemant Agrawal > <hemant.agrawal@oss.nxp.com> wrote: >> On 15-Feb-23 8:46 PM, Thomas Monjalon wrote: >>> 15/02/2023 11:29, Hemant Agrawal: >>>> This patch replaces simple printf with fprintf for debug dump >>>> related functions for various NXP dpaaX related drivers. >>> Why replacing with fprintf(stdout)? >>> >>> Would it be better to provide a FILE* parameter to the functions? >> yes, I will update. > Any news for this series? > At least a rebase is needed, I marked it as changes requested. I missed it. i will send it. > > ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/2] drivers: replace printf with fprintf for debug functions 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-15 17:17 ` Stephen Hemminger 1 sibling, 0 replies; 22+ messages in thread From: Stephen Hemminger @ 2023-02-15 17:17 UTC (permalink / raw) To: Hemant Agrawal; +Cc: dev, thomas On Wed, 15 Feb 2023 15:59:05 +0530 Hemant Agrawal <hemant.agrawal@nxp.com> wrote: > diff --git a/drivers/bus/dpaa/base/fman/netcfg_layer.c b/drivers/bus/dpaa/base/fman/netcfg_layer.c > index 6a405c984d..69cee08fb9 100644 > --- a/drivers/bus/dpaa/base/fman/netcfg_layer.c > +++ b/drivers/bus/dpaa/base/fman/netcfg_layer.c > @@ -33,33 +33,33 @@ dump_netcfg(struct netcfg_info *cfg_ptr) > { > int i; > > - printf(".......... DPAA Configuration ..........\n\n"); > + fprintf(stdout, ".......... DPAA Configuration ..........\n\n"); > If you only do "printf -> fprintf(stdout," then it doesn't make sense. Ideally change debug interface to take a user supplied output FILE * like other dump routines. ^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v2 1/2] drivers: replace printf with log macros 2023-02-15 10:29 [PATCH 1/2] drivers: replace printf with log macros Hemant Agrawal 2023-02-15 10:29 ` [PATCH 2/2] drivers: replace printf with fprintf for debug functions Hemant Agrawal @ 2024-07-02 10:40 ` Hemant Agrawal 2024-07-02 10:40 ` [PATCH v2 2/2] drivers: replace printf with fprintf for debug functions Hemant Agrawal ` (2 more replies) 1 sibling, 3 replies; 22+ messages in thread From: Hemant Agrawal @ 2024-07-02 10:40 UTC (permalink / raw) To: dev, thomas, stephen, david.marchand 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 | 8 +++---- 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 | 2 +- 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 | 10 ++++----- 12 files changed, 37 insertions(+), 38 deletions(-) diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c index 1814372a40..2fc1e64f36 100644 --- a/drivers/bus/dpaa/base/fman/fman.c +++ b/drivers/bus/dpaa/base/fman/fman.c @@ -425,7 +425,7 @@ fman_if_init(const struct device_node *dpa_node) char_prop = of_get_property(mac_node, "phy-connection-type", NULL); if (!char_prop) { - printf("memac: unknown MII type assuming 1G\n"); + FMAN_ERR(-EINVAL, "memac: unknown MII type assuming 1G\n"); /* Right now forcing memac to 1g in case of error*/ __if->__if.mac_type = fman_mac_1g; } else { @@ -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)\n", strerror(errno)); + DPAA_BUS_INFO("Tearing down %s\n", __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..af1e459641 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\n"); 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\n", 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\n"); else - printf("Failed to disable interrupt\n"); + DPAA_BUS_ERR("Failed to disable interrupt\n"); 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\n"); 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\n"); 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\n"); else - printf("Failed to get link status\n"); + DPAA_BUS_ERR("Failed to get link status\n"); 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\n"); 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\n"); else - printf("Failed to set link speed\n"); + DPAA_BUS_ERR("Failed to set link speed\n"); 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\n"); else - printf("Failed to restart autoneg\n"); + DPAA_BUS_ERR("Failed to restart autoneg\n"); 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..da0669d554 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)\n", 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..ab06fab387 100644 --- a/drivers/crypto/caam_jr/caam_jr.c +++ b/drivers/crypto/caam_jr/caam_jr.c @@ -587,7 +587,7 @@ 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 + CAAM_JR_ERR("false alarm %" PRIu64 "real %" PRIu64 " sec_err =0x%x cidx Index =0%d\n", false_alarm, real_poll, sec_error_code, job_ring->cidx); diff --git a/drivers/crypto/caam_jr/caam_jr_uio.c b/drivers/crypto/caam_jr/caam_jr_uio.c index 583ba3b523..586beceb14 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\n", 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..5c75f4220e 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\n"); } if (dpaa_fm_term()) - printf("\nDPAA FM term failed\n"); + DPAA_PMD_ERR("DPAA FM term failed\n"); 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..89b4454e6b 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\n"); 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..cd6739dcfa 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\n"); } } @@ -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\n", node->id); return -1; } @@ -590,7 +590,7 @@ 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, ((node->parent->channel_id << 8) | tc_id), flow_id, @@ -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 ^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v2 2/2] drivers: replace printf with fprintf for debug functions 2024-07-02 10:40 ` [PATCH v2 1/2] drivers: replace printf with log macros Hemant Agrawal @ 2024-07-02 10:40 ` Hemant Agrawal 2024-07-02 15:11 ` Stephen Hemminger 2024-07-02 12:15 ` [PATCH v2 1/2] drivers: replace printf with log macros David Marchand 2024-07-02 13:08 ` [PATCH v3 1/3] " Hemant Agrawal 2 siblings, 1 reply; 22+ messages in thread From: Hemant Agrawal @ 2024-07-02 10:40 UTC (permalink / raw) To: dev, thomas, stephen, david.marchand This patch replaces simple printf with fprintf for debug dump related functions for various NXP dpaaX related drivers. Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com> --- drivers/bus/dpaa/base/fman/netcfg_layer.c | 22 +++---- drivers/bus/dpaa/dpaa_bus.c | 2 +- drivers/bus/dpaa/include/netcfg.h | 2 +- drivers/crypto/caam_jr/caam_jr.c | 6 +- drivers/crypto/caam_jr/caam_jr_desc.h | 4 +- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 32 +++++----- drivers/crypto/dpaa_sec/dpaa_sec.c | 62 +++++++++---------- drivers/net/dpaa2/dpaa2_flow.c | 66 +++++++++++---------- 8 files changed, 99 insertions(+), 97 deletions(-) diff --git a/drivers/bus/dpaa/base/fman/netcfg_layer.c b/drivers/bus/dpaa/base/fman/netcfg_layer.c index 6a405c984d..57d87afcb0 100644 --- a/drivers/bus/dpaa/base/fman/netcfg_layer.c +++ b/drivers/bus/dpaa/base/fman/netcfg_layer.c @@ -29,37 +29,37 @@ static int skfd = -1; #ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER void -dump_netcfg(struct netcfg_info *cfg_ptr) +dump_netcfg(struct netcfg_info *cfg_ptr, FILE *f) { int i; - printf(".......... DPAA Configuration ..........\n\n"); + fprintf(f, ".......... DPAA Configuration ..........\n\n"); /* Network interfaces */ - printf("Network interfaces: %d\n", cfg_ptr->num_ethports); + fprintf(f, "Network interfaces: %d\n", cfg_ptr->num_ethports); for (i = 0; i < cfg_ptr->num_ethports; i++) { struct fman_if_bpool *bpool; struct fm_eth_port_cfg *p_cfg = &cfg_ptr->port_cfg[i]; struct fman_if *__if = p_cfg->fman_if; - printf("\n+ Fman %d, MAC %d (%s);\n", + fprintf(f, "\n+ Fman %d, MAC %d (%s);\n", __if->fman_idx, __if->mac_idx, (__if->mac_type == fman_mac_1g) ? "1G" : (__if->mac_type == fman_mac_2_5g) ? "2.5G" : "10G"); - printf("\tmac_addr: " RTE_ETHER_ADDR_PRT_FMT "\n", + fprintf(f, "\tmac_addr: " RTE_ETHER_ADDR_PRT_FMT "\n", RTE_ETHER_ADDR_BYTES(&__if->mac_addr)); - printf("\ttx_channel_id: 0x%02x\n", + fprintf(f, "\ttx_channel_id: 0x%02x\n", __if->tx_channel_id); - printf("\tfqid_rx_def: 0x%x\n", p_cfg->rx_def); - printf("\tfqid_rx_err: 0x%x\n", __if->fqid_rx_err); + fprintf(f, "\tfqid_rx_def: 0x%x\n", p_cfg->rx_def); + fprintf(f, "\tfqid_rx_err: 0x%x\n", __if->fqid_rx_err); - printf("\tfqid_tx_err: 0x%x\n", __if->fqid_tx_err); - printf("\tfqid_tx_confirm: 0x%x\n", __if->fqid_tx_confirm); + fprintf(f, "\tfqid_tx_err: 0x%x\n", __if->fqid_tx_err); + fprintf(f, "\tfqid_tx_confirm: 0x%x\n", __if->fqid_tx_confirm); fman_if_for_each_bpool(bpool, __if) - printf("\tbuffer pool: (bpid=%d, count=%"PRId64 + fprintf(f, "\tbuffer pool: (bpid=%d, count=%"PRId64 " size=%"PRId64", addr=0x%"PRIx64")\n", bpool->bpid, bpool->count, bpool->size, bpool->addr); diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c index 5d4352bb3c..7e5d713bb9 100644 --- a/drivers/bus/dpaa/dpaa_bus.c +++ b/drivers/bus/dpaa/dpaa_bus.c @@ -586,7 +586,7 @@ rte_dpaa_bus_dev_build(void) } #ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER - dump_netcfg(dpaa_netcfg); + dump_netcfg(dpaa_netcfg, stdout); #endif DPAA_BUS_LOG(DEBUG, "Number of ethernet devices = %d", diff --git a/drivers/bus/dpaa/include/netcfg.h b/drivers/bus/dpaa/include/netcfg.h index 5bdcc9186a..ebbbaf6d10 100644 --- a/drivers/bus/dpaa/include/netcfg.h +++ b/drivers/bus/dpaa/include/netcfg.h @@ -60,7 +60,7 @@ void netcfg_release(struct netcfg_info *cfg_ptr); /* cfg_ptr: configuration information pointer. * This function dumps configuration data to stdout. */ -void dump_netcfg(struct netcfg_info *cfg_ptr); +void dump_netcfg(struct netcfg_info *cfg_ptr, FILE *f); #endif #endif /* __NETCFG_H */ diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c index ab06fab387..ea474a079f 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; @@ -1410,9 +1410,9 @@ caam_jr_enqueue_op(struct rte_crypto_op *op, struct caam_jr_qp *qp) rte_pktmbuf_mtod(op->sym->m_src, void *), rte_pktmbuf_data_len(op->sym->m_src)); - printf("\n JD before conversion\n"); + fprintf(stdout, "\n JD before conversion\n"); for (i = 0; i < 12; i++) - printf("\n 0x%08x", ctx->jobdes.desc[i]); + fprintf(stdout, "\n 0x%08x", ctx->jobdes.desc[i]); #endif CAAM_JR_DP_DEBUG("Jr[%p] pi[%d] ci[%d].Before sending desc", diff --git a/drivers/crypto/caam_jr/caam_jr_desc.h b/drivers/crypto/caam_jr/caam_jr_desc.h index c85278bf1e..a4507613be 100644 --- a/drivers/crypto/caam_jr/caam_jr_desc.h +++ b/drivers/crypto/caam_jr/caam_jr_desc.h @@ -110,13 +110,13 @@ ((struct descriptor_header_s *)(descriptor))->command.jd.desclen) /* Helper macro for dumping the hex representation of a descriptor */ -#define SEC_DUMP_DESC(descriptor) { \ +#define SEC_DUMP_DESC(descriptor, f) { \ int __i; \ CAAM_JR_INFO("Des@ 0x%08x\n", (uint32_t)((uint32_t *)(descriptor)));\ for (__i = 0; \ __i < SEC_GET_DESC_LEN(descriptor); \ __i++) { \ - printf("0x%08x: 0x%08x\n", \ + fprintf(f, "0x%08x: 0x%08x\n", \ (uint32_t)(((uint32_t *)(descriptor)) + __i), \ *(((uint32_t *)(descriptor)) + __i)); \ } \ diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c index 1cae6c4505..4c5b98d9be 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -1621,7 +1621,7 @@ sec_fd_to_mbuf(const struct qbman_fd *fd, struct dpaa2_sec_qp *qp) } static void -dpaa2_sec_dump(struct rte_crypto_op *op) +dpaa2_sec_dump(struct rte_crypto_op *op, FILE *f) { int i; dpaa2_sec_session *sess = NULL; @@ -1640,18 +1640,18 @@ dpaa2_sec_dump(struct rte_crypto_op *op) goto mbuf_dump; priv = (struct ctxt_priv *)sess->ctxt; - printf("\n****************************************\n" + fprintf(f, "\n****************************************\n" "session params:\n\tContext type:\t%d\n\tDirection:\t%s\n" "\tCipher alg:\t%d\n\tAuth alg:\t%d\n\tAead alg:\t%d\n" "\tCipher key len:\t%zd\n", sess->ctxt_type, (sess->dir == DIR_ENC) ? "DIR_ENC" : "DIR_DEC", sess->cipher_alg, sess->auth_alg, sess->aead_alg, sess->cipher_key.length); - rte_hexdump(stdout, "cipher key", sess->cipher_key.data, + rte_hexdump(f, "cipher key", sess->cipher_key.data, sess->cipher_key.length); - rte_hexdump(stdout, "auth key", sess->auth_key.data, + rte_hexdump(f, "auth key", sess->auth_key.data, sess->auth_key.length); - printf("\tAuth key len:\t%zd\n\tIV len:\t\t%d\n\tIV offset:\t%d\n" + fprintf(f, "\tAuth key len:\t%zd\n\tIV len:\t\t%d\n\tIV offset:\t%d\n" "\tdigest length:\t%d\n\tstatus:\t\t%d\n\taead auth only" " len:\t%d\n\taead cipher text:\t%d\n", sess->auth_key.length, sess->iv.length, sess->iv.offset, @@ -1659,7 +1659,7 @@ dpaa2_sec_dump(struct rte_crypto_op *op) sess->ext_params.aead_ctxt.auth_only_len, sess->ext_params.aead_ctxt.auth_cipher_text); #ifdef RTE_LIB_SECURITY - printf("PDCP session params:\n" + fprintf(f, "PDCP session params:\n" "\tDomain:\t\t%d\n\tBearer:\t\t%d\n\tpkt_dir:\t%d\n\thfn_ovd:" "\t%d\n\tsn_size:\t%d\n\thfn_ovd_offset:\t%d\n\thfn:\t\t%d\n" "\thfn_threshold:\t0x%x\n", sess->pdcp.domain, @@ -1669,29 +1669,29 @@ dpaa2_sec_dump(struct rte_crypto_op *op) #endif bufsize = (uint8_t)priv->flc_desc[0].flc.word1_sdl; - printf("Descriptor Dump:\n"); + fprintf(f, "Descriptor Dump:\n"); for (i = 0; i < bufsize; i++) - printf("\tDESC[%d]:0x%x\n", i, priv->flc_desc[0].desc[i]); + fprintf(f, "\tDESC[%d]:0x%x\n", i, priv->flc_desc[0].desc[i]); - printf("\n"); + fprintf(f, "\n"); mbuf_dump: sym_op = op->sym; if (sym_op->m_src) { - printf("Source mbuf:\n"); - rte_pktmbuf_dump(stdout, sym_op->m_src, sym_op->m_src->data_len); + fprintf(f, "Source mbuf:\n"); + rte_pktmbuf_dump(f, sym_op->m_src, sym_op->m_src->data_len); } if (sym_op->m_dst) { - printf("Destination mbuf:\n"); - rte_pktmbuf_dump(stdout, sym_op->m_dst, sym_op->m_dst->data_len); + fprintf(f, "Destination mbuf:\n"); + rte_pktmbuf_dump(f, sym_op->m_dst, sym_op->m_dst->data_len); } - printf("Session address = %p\ncipher offset: %d, length: %d\n" + fprintf(f, "Session address = %p\ncipher offset: %d, length: %d\n" "auth offset: %d, length: %d\n aead offset: %d, length: %d\n" , sym_op->session, sym_op->cipher.data.offset, sym_op->cipher.data.length, sym_op->auth.data.offset, sym_op->auth.data.length, sym_op->aead.data.offset, sym_op->aead.data.length); - printf("\n"); + fprintf(f, "\n"); } @@ -1951,7 +1951,7 @@ dpaa2_sec_dequeue_burst(void *qp, struct rte_crypto_op **ops, DPAA2_SEC_DP_ERR("SEC returned Error - %x\n", fd->simple.frc); if (dpaa2_sec_dp_dump > DPAA2_SEC_DP_ERR_DUMP) - dpaa2_sec_dump(ops[num_rx]); + dpaa2_sec_dump(ops[num_rx], stdout); } dpaa2_qp->rx_vq.err_pkts += 1; diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c index 44528eaf7f..7aa163330a 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.c +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c @@ -654,7 +654,7 @@ dpaa_sec_prep_cdb(dpaa_sec_session *ses) } static void -dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp) +dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp, FILE *f) { struct dpaa_sec_job *job = &ctx->job; struct rte_crypto_op *op = ctx->op; @@ -678,9 +678,9 @@ dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp) cdb = &sess->cdb; rte_memcpy(&c_cdb, cdb, sizeof(struct sec_cdb)); #ifdef RTE_LIB_SECURITY - printf("\nsession protocol type = %d\n", sess->proto_alg); + fprintf(f, "\nsession protocol type = %d\n", sess->proto_alg); #endif - printf("\n****************************************\n" + fprintf(f, "\n****************************************\n" "session params:\n\tContext type:\t%d\n\tDirection:\t%s\n" "\tCipher alg:\t%d\n\tAuth alg:\t%d\n\tAead alg:\t%d\n" "\tCipher key len:\t%"PRIu64"\n\tCipher alg:\t%d\n" @@ -689,11 +689,11 @@ dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp) sess->cipher_alg, sess->auth_alg, sess->aead_alg, (uint64_t)sess->cipher_key.length, sess->cipher_key.alg, sess->cipher_key.algmode); - rte_hexdump(stdout, "cipher key", sess->cipher_key.data, + rte_hexdump(f, "cipher key", sess->cipher_key.data, sess->cipher_key.length); - rte_hexdump(stdout, "auth key", sess->auth_key.data, + rte_hexdump(f, "auth key", sess->auth_key.data, sess->auth_key.length); - printf("\tAuth key len:\t%"PRIu64"\n\tAuth alg:\t%d\n" + fprintf(f, "\tAuth key len:\t%"PRIu64"\n\tAuth alg:\t%d\n" "\tAuth algmode:\t%d\n\tIV len:\t\t%d\n\tIV offset:\t%d\n" "\tdigest length:\t%d\n\tauth only len:\t\t%d\n" "\taead cipher text:\t%d\n", @@ -703,7 +703,7 @@ dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp) sess->digest_length, sess->auth_only_len, sess->auth_cipher_text); #ifdef RTE_LIB_SECURITY - printf("PDCP session params:\n" + fprintf(f, "PDCP session params:\n" "\tDomain:\t\t%d\n\tBearer:\t\t%d\n\tpkt_dir:\t%d\n\thfn_ovd:" "\t%d\n\tsn_size:\t%d\n\tsdap_enabled:\t%d\n\thfn_ovd_offset:" "\t%d\n\thfn:\t\t%d\n" @@ -717,63 +717,63 @@ dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp) c_cdb.sh_hdr.lo.word = rte_be_to_cpu_32(c_cdb.sh_hdr.lo.word); bufsize = c_cdb.sh_hdr.hi.field.idlen; - printf("cdb = %p\n\n", cdb); - printf("Descriptor size = %d\n", bufsize); + fprintf(f, "cdb = %p\n\n", cdb); + fprintf(f, "Descriptor size = %d\n", bufsize); int m; for (m = 0; m < bufsize; m++) - printf("0x%x\n", rte_be_to_cpu_32(c_cdb.sh_desc[m])); + fprintf(f, "0x%x\n", rte_be_to_cpu_32(c_cdb.sh_desc[m])); - printf("\n"); + fprintf(f, "\n"); mbuf_dump: sym_op = op->sym; if (sym_op->m_src) { - printf("Source mbuf:\n"); - rte_pktmbuf_dump(stdout, sym_op->m_src, + fprintf(f, "Source mbuf:\n"); + rte_pktmbuf_dump(f, sym_op->m_src, sym_op->m_src->data_len); } if (sym_op->m_dst) { - printf("Destination mbuf:\n"); - rte_pktmbuf_dump(stdout, sym_op->m_dst, + fprintf(f, "Destination mbuf:\n"); + rte_pktmbuf_dump(f, sym_op->m_dst, sym_op->m_dst->data_len); } - printf("Session address = %p\ncipher offset: %d, length: %d\n" + fprintf(f, "Session address = %p\ncipher offset: %d, length: %d\n" "auth offset: %d, length: %d\n aead offset: %d, length: %d\n", sym_op->session, sym_op->cipher.data.offset, sym_op->cipher.data.length, sym_op->auth.data.offset, sym_op->auth.data.length, sym_op->aead.data.offset, sym_op->aead.data.length); - printf("\n"); + fprintf(f, "\n"); - printf("******************************************************\n"); - printf("ctx info:\n"); - printf("job->sg[0] output info:\n"); + fprintf(f, "******************************************************\n"); + fprintf(f, "ctx info:\n"); + fprintf(f, "job->sg[0] output info:\n"); memcpy(&sg[0], &job->sg[0], sizeof(sg[0])); - printf("\taddr = %"PRIx64",\n\tlen = %d,\n\tfinal = %d,\n\textension = %d" + fprintf(f, "\taddr = %"PRIx64",\n\tlen = %d,\n\tfinal = %d,\n\textension = %d" "\n\tbpid = %d\n\toffset = %d\n", (uint64_t)sg[0].addr, sg[0].length, sg[0].final, sg[0].extension, sg[0].bpid, sg[0].offset); - printf("\njob->sg[1] input info:\n"); + fprintf(f, "\njob->sg[1] input info:\n"); memcpy(&sg[1], &job->sg[1], sizeof(sg[1])); hw_sg_to_cpu(&sg[1]); - printf("\taddr = %"PRIx64",\n\tlen = %d,\n\tfinal = %d,\n\textension = %d" + fprintf(f, "\taddr = %"PRIx64",\n\tlen = %d,\n\tfinal = %d,\n\textension = %d" "\n\tbpid = %d\n\toffset = %d\n", (uint64_t)sg[1].addr, sg[1].length, sg[1].final, sg[1].extension, sg[1].bpid, sg[1].offset); - printf("\nctx pool addr = %p\n", ctx->ctx_pool); + fprintf(f, "\nctx pool addr = %p\n", ctx->ctx_pool); if (ctx->ctx_pool) - printf("ctx pool available counts = %d\n", + fprintf(f, "ctx pool available counts = %d\n", rte_mempool_avail_count(ctx->ctx_pool)); - printf("\nop pool addr = %p\n", op->mempool); + fprintf(f, "\nop pool addr = %p\n", op->mempool); if (op->mempool) - printf("op pool available counts = %d\n", + fprintf(f, "op pool available counts = %d\n", rte_mempool_avail_count(op->mempool)); - printf("********************************************************\n"); - printf("Queue data:\n"); - printf("\tFQID = 0x%x\n\tstate = %d\n\tnb_desc = %d\n" + fprintf(f, "********************************************************\n"); + fprintf(f, "Queue data:\n"); + fprintf(f, "\tFQID = 0x%x\n\tstate = %d\n\tnb_desc = %d\n" "\tctx_pool = %p\n\trx_pkts = %d\n\ttx_pkts" "= %d\n\trx_errs = %d\n\ttx_errs = %d\n\n", qp->outq.fqid, qp->outq.state, qp->outq.nb_desc, @@ -852,7 +852,7 @@ dpaa_sec_deq(struct dpaa_sec_qp *qp, struct rte_crypto_op **ops, int nb_ops) DPAA_SEC_DP_WARN("SEC return err:0x%x\n", ctx->fd_status); if (dpaa_sec_dp_dump > DPAA_SEC_DP_ERR_DUMP) - dpaa_sec_dump(ctx, qp); + dpaa_sec_dump(ctx, qp, stdout); } op->status = RTE_CRYPTO_OP_STATUS_ERROR; } diff --git a/drivers/net/dpaa2/dpaa2_flow.c b/drivers/net/dpaa2/dpaa2_flow.c index eec7e60650..6c7bac4d48 100644 --- a/drivers/net/dpaa2/dpaa2_flow.c +++ b/drivers/net/dpaa2/dpaa2_flow.c @@ -236,7 +236,7 @@ static inline void dpaa2_prot_field_string( } static inline void dpaa2_flow_qos_table_extracts_log( - const struct dpaa2_dev_priv *priv) + const struct dpaa2_dev_priv *priv, FILE *f) { int idx; char string[32]; @@ -244,7 +244,7 @@ static inline void dpaa2_flow_qos_table_extracts_log( if (!dpaa2_flow_control_log) return; - printf("Setup QoS table: number of extracts: %d\r\n", + fprintf(f, "Setup QoS table: number of extracts: %d\r\n", priv->extract.qos_key_extract.dpkg.num_extracts); for (idx = 0; idx < priv->extract.qos_key_extract.dpkg.num_extracts; idx++) { @@ -253,15 +253,15 @@ static inline void dpaa2_flow_qos_table_extracts_log( priv->extract.qos_key_extract.dpkg.extracts[idx] .extract.from_hdr.field, string); - printf("%s", string); + fprintf(f, "%s", string); if ((idx + 1) < priv->extract.qos_key_extract.dpkg.num_extracts) - printf(" / "); + fprintf(f, " / "); } - printf("\r\n"); + fprintf(f, "\r\n"); } static inline void dpaa2_flow_fs_table_extracts_log( - const struct dpaa2_dev_priv *priv, int tc_id) + const struct dpaa2_dev_priv *priv, int tc_id, FILE *f) { int idx; char string[32]; @@ -269,7 +269,7 @@ static inline void dpaa2_flow_fs_table_extracts_log( if (!dpaa2_flow_control_log) return; - printf("Setup FS table: number of extracts of TC[%d]: %d\r\n", + fprintf(f, "Setup FS table: number of extracts of TC[%d]: %d\r\n", tc_id, priv->extract.tc_key_extract[tc_id] .dpkg.num_extracts); for (idx = 0; idx < priv->extract.tc_key_extract[tc_id] @@ -279,16 +279,16 @@ static inline void dpaa2_flow_fs_table_extracts_log( priv->extract.tc_key_extract[tc_id].dpkg.extracts[idx] .extract.from_hdr.field, string); - printf("%s", string); + fprintf(f, "%s", string); if ((idx + 1) < priv->extract.tc_key_extract[tc_id] .dpkg.num_extracts) - printf(" / "); + fprintf(f, " / "); } - printf("\r\n"); + fprintf(f, "\r\n"); } static inline void dpaa2_flow_qos_entry_log( - const char *log_info, const struct rte_flow *flow, int qos_index) + const char *log_info, const struct rte_flow *flow, int qos_index, FILE *f) { int idx; uint8_t *key, *mask; @@ -296,27 +296,27 @@ static inline void dpaa2_flow_qos_entry_log( if (!dpaa2_flow_control_log) return; - printf("\r\n%s QoS entry[%d] for TC[%d], extracts size is %d\r\n", + fprintf(f, "\r\n%s QoS entry[%d] for TC[%d], extracts size is %d\r\n", log_info, qos_index, flow->tc_id, flow->qos_real_key_size); key = (uint8_t *)(size_t)flow->qos_rule.key_iova; mask = (uint8_t *)(size_t)flow->qos_rule.mask_iova; - printf("key:\r\n"); + fprintf(f, "key:\r\n"); for (idx = 0; idx < flow->qos_real_key_size; idx++) - printf("%02x ", key[idx]); + fprintf(f, "%02x ", key[idx]); - printf("\r\nmask:\r\n"); + fprintf(f, "\r\nmask:\r\n"); for (idx = 0; idx < flow->qos_real_key_size; idx++) - printf("%02x ", mask[idx]); + fprintf(f, "%02x ", mask[idx]); - printf("\r\n%s QoS ipsrc: %d, ipdst: %d\r\n", log_info, + fprintf(f, "\r\n%s QoS ipsrc: %d, ipdst: %d\r\n", log_info, flow->ipaddr_rule.qos_ipsrc_offset, flow->ipaddr_rule.qos_ipdst_offset); } static inline void dpaa2_flow_fs_entry_log( - const char *log_info, const struct rte_flow *flow) + const char *log_info, const struct rte_flow *flow, FILE *f) { int idx; uint8_t *key, *mask; @@ -324,21 +324,21 @@ static inline void dpaa2_flow_fs_entry_log( if (!dpaa2_flow_control_log) return; - printf("\r\n%s FS/TC entry[%d] of TC[%d], extracts size is %d\r\n", + fprintf(f, "\r\n%s FS/TC entry[%d] of TC[%d], extracts size is %d\r\n", log_info, flow->tc_index, flow->tc_id, flow->fs_real_key_size); key = (uint8_t *)(size_t)flow->fs_rule.key_iova; mask = (uint8_t *)(size_t)flow->fs_rule.mask_iova; - printf("key:\r\n"); + fprintf(f, "key:\r\n"); for (idx = 0; idx < flow->fs_real_key_size; idx++) - printf("%02x ", key[idx]); + fprintf(f, "%02x ", key[idx]); - printf("\r\nmask:\r\n"); + fprintf(f, "\r\nmask:\r\n"); for (idx = 0; idx < flow->fs_real_key_size; idx++) - printf("%02x ", mask[idx]); + fprintf(f, "%02x ", mask[idx]); - printf("\r\n%s FS ipsrc: %d, ipdst: %d\r\n", log_info, + fprintf(f, "\r\n%s FS ipsrc: %d, ipdst: %d\r\n", log_info, flow->ipaddr_rule.fs_ipsrc_offset, flow->ipaddr_rule.fs_ipdst_offset); } @@ -3017,7 +3017,7 @@ dpaa2_flow_entry_update( qos_index = curr->tc_id * priv->fs_entries + curr->tc_index; - dpaa2_flow_qos_entry_log("Before update", curr, qos_index); + dpaa2_flow_qos_entry_log("Before update", curr, qos_index, stdout); if (priv->num_rx_tc > 1) { ret = dpni_remove_qos_entry(dpni, CMD_PRI_LOW, @@ -3124,7 +3124,7 @@ dpaa2_flow_entry_update( curr->qos_rule.key_size = FIXED_ENTRY_SIZE; - dpaa2_flow_qos_entry_log("Start update", curr, qos_index); + dpaa2_flow_qos_entry_log("Start update", curr, qos_index, stdout); if (priv->num_rx_tc > 1) { ret = dpni_add_qos_entry(dpni, CMD_PRI_LOW, @@ -3142,7 +3142,7 @@ dpaa2_flow_entry_update( continue; } - dpaa2_flow_fs_entry_log("Before update", curr); + dpaa2_flow_fs_entry_log("Before update", curr, stdout); extend = -1; ret = dpni_remove_fs_entry(dpni, CMD_PRI_LOW, @@ -3237,7 +3237,7 @@ dpaa2_flow_entry_update( curr->fs_real_key_size += extend; curr->fs_rule.key_size = FIXED_ENTRY_SIZE; - dpaa2_flow_fs_entry_log("Start update", curr); + dpaa2_flow_fs_entry_log("Start update", curr, stdout); ret = dpni_add_fs_entry(dpni, CMD_PRI_LOW, priv->token, curr->tc_id, curr->tc_index, @@ -3541,7 +3541,8 @@ dpaa2_generic_flow_set(struct rte_flow *flow, /* Configure FS table first*/ if (is_keycfg_configured & DPAA2_FS_TABLE_RECONFIGURE) { - dpaa2_flow_fs_table_extracts_log(priv, flow->tc_id); + dpaa2_flow_fs_table_extracts_log(priv, + flow->tc_id, stdout); if (dpkg_prepare_key_cfg( &priv->extract.tc_key_extract[flow->tc_id].dpkg, (uint8_t *)(size_t)priv->extract @@ -3580,7 +3581,7 @@ dpaa2_generic_flow_set(struct rte_flow *flow, /* Configure QoS table then.*/ if (is_keycfg_configured & DPAA2_QOS_TABLE_RECONFIGURE) { - dpaa2_flow_qos_table_extracts_log(priv); + dpaa2_flow_qos_table_extracts_log(priv, stdout); if (dpkg_prepare_key_cfg( &priv->extract.qos_key_extract.dpkg, (uint8_t *)(size_t)priv->extract.qos_extract_param) < 0) { @@ -3646,7 +3647,8 @@ dpaa2_generic_flow_set(struct rte_flow *flow, } flow->qos_rule.key_size = FIXED_ENTRY_SIZE; - dpaa2_flow_qos_entry_log("Start add", flow, qos_index); + dpaa2_flow_qos_entry_log("Start add", flow, + qos_index, stdout); ret = dpni_add_qos_entry(dpni, CMD_PRI_LOW, priv->token, &flow->qos_rule, @@ -3697,7 +3699,7 @@ dpaa2_generic_flow_set(struct rte_flow *flow, flow->fs_rule.key_size = FIXED_ENTRY_SIZE; - dpaa2_flow_fs_entry_log("Start add", flow); + dpaa2_flow_fs_entry_log("Start add", flow, stdout); ret = dpni_add_fs_entry(dpni, CMD_PRI_LOW, priv->token, flow->tc_id, flow->tc_index, -- 2.25.1 ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 2/2] drivers: replace printf with fprintf for debug functions 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 0 siblings, 1 reply; 22+ messages in thread From: Stephen Hemminger @ 2024-07-02 15:11 UTC (permalink / raw) To: Hemant Agrawal; +Cc: dev, thomas, david.marchand On Tue, 2 Jul 2024 16:10:13 +0530 Hemant Agrawal <hemant.agrawal@nxp.com> wrote: > > - printf("\n JD before conversion\n"); > + fprintf(stdout, "\n JD before conversion\n"); > for (i = 0; i < 12; i++) > - printf("\n 0x%08x", ctx->jobdes.desc[i]); > + fprintf(stdout, "\n 0x%08x", ctx->jobdes.desc[i]); Don't see the point of this change, printf() and fprintf(stdout) are same thing. ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 2/2] drivers: replace printf with fprintf for debug functions 2024-07-02 15:11 ` Stephen Hemminger @ 2024-07-02 17:26 ` Hemant Agrawal 0 siblings, 0 replies; 22+ messages in thread From: Hemant Agrawal @ 2024-07-02 17:26 UTC (permalink / raw) To: Stephen Hemminger, Hemant Agrawal; +Cc: dev, thomas, david.marchand On 02-07-2024 20:41, Stephen Hemminger wrote: > On Tue, 2 Jul 2024 16:10:13 +0530 > Hemant Agrawal <hemant.agrawal@nxp.com> wrote: > >> >> - printf("\n JD before conversion\n"); >> + fprintf(stdout, "\n JD before conversion\n"); >> for (i = 0; i < 12; i++) >> - printf("\n 0x%08x", ctx->jobdes.desc[i]); >> + fprintf(stdout, "\n 0x%08x", ctx->jobdes.desc[i]); > Don't see the point of this change, printf() and fprintf(stdout) are same thing. Yes, but no harm in this change. It was originally a script based change in the files. Now the code is consistent - only using fprintf. Either with f or with stdout. ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 1/2] drivers: replace printf with log macros 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 12:15 ` David Marchand 2024-07-02 13:08 ` [PATCH v3 1/3] " Hemant Agrawal 2 siblings, 0 replies; 22+ messages in thread From: David Marchand @ 2024-07-02 12:15 UTC (permalink / raw) To: Hemant Agrawal; +Cc: dev, thomas, stephen On Tue, Jul 2, 2024 at 12:40 PM Hemant Agrawal <hemant.agrawal@nxp.com> wrote: > > 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> Please double check callers of DPAA_BUS_LOG to avoid log messages ending with \n\n. I see that DPAA_BUS_LOG is called from DPAA_BUS_(ERR|INFO|WARN) and FMAN_ERR. -- David Marchand ^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v3 1/3] drivers: replace printf with log macros 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 12:15 ` [PATCH v2 1/2] drivers: replace printf with log macros David Marchand @ 2024-07-02 13:08 ` Hemant Agrawal 2024-07-02 13:08 ` [PATCH v3 2/3] bus/dpaa: remove double newline Hemant Agrawal ` (3 more replies) 2 siblings, 4 replies; 22+ messages in thread From: Hemant Agrawal @ 2024-07-02 13:08 UTC (permalink / raw) To: dev, thomas, stephen, david.marchand 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 ^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v3 2/3] bus/dpaa: remove double newline 2024-07-02 13:08 ` [PATCH v3 1/3] " Hemant Agrawal @ 2024-07-02 13:08 ` Hemant Agrawal 2024-07-02 13:08 ` [PATCH v3 3/3] drivers: replace printf with fprintf for debug functions Hemant Agrawal ` (2 subsequent siblings) 3 siblings, 0 replies; 22+ messages in thread From: Hemant Agrawal @ 2024-07-02 13:08 UTC (permalink / raw) To: dev, thomas, stephen, david.marchand Remove duplicate newline `\n` from the debugging macros to avoid double `\n\n`. Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com> --- drivers/bus/dpaa/base/fman/fman.c | 58 +++++++++++++++---------------- drivers/bus/dpaa/dpaa_bus.c | 12 +++---- 2 files changed, 34 insertions(+), 36 deletions(-) diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c index 953f7d7061..41195eb0a7 100644 --- a/drivers/bus/dpaa/base/fman/fman.c +++ b/drivers/bus/dpaa/base/fman/fman.c @@ -244,13 +244,13 @@ fman_if_init(const struct device_node *dpa_node) /* Obtain the MAC node used by this interface except macless */ mac_phandle = of_get_property(dpa_node, mprop, &lenp); if (!mac_phandle) { - FMAN_ERR(-EINVAL, "%s: no %s\n", dname, mprop); + FMAN_ERR(-EINVAL, "%s: no %s", dname, mprop); return -EINVAL; } assert(lenp == sizeof(phandle)); mac_node = of_find_node_by_phandle(*mac_phandle); if (!mac_node) { - FMAN_ERR(-ENXIO, "%s: bad 'fsl,fman-mac\n", dname); + FMAN_ERR(-ENXIO, "%s: bad 'fsl,fman-mac", dname); return -ENXIO; } mname = mac_node->full_name; @@ -262,19 +262,19 @@ fman_if_init(const struct device_node *dpa_node) ports_phandle = of_get_property(mac_node, "fsl,fman-ports", &lenp); if (!ports_phandle) { - FMAN_ERR(-EINVAL, "%s: no fsl,port-handles\n", + FMAN_ERR(-EINVAL, "%s: no fsl,port-handles", mname); return -EINVAL; } assert(lenp == (2 * sizeof(phandle))); rx_node = of_find_node_by_phandle(ports_phandle[0]); if (!rx_node) { - FMAN_ERR(-ENXIO, "%s: bad fsl,port-handle[0]\n", mname); + FMAN_ERR(-ENXIO, "%s: bad fsl,port-handle[0]", mname); return -ENXIO; } tx_node = of_find_node_by_phandle(ports_phandle[1]); if (!tx_node) { - FMAN_ERR(-ENXIO, "%s: bad fsl,port-handle[1]\n", mname); + FMAN_ERR(-ENXIO, "%s: bad fsl,port-handle[1]", mname); return -ENXIO; } @@ -282,8 +282,7 @@ fman_if_init(const struct device_node *dpa_node) if (of_device_is_compatible(dpa_node, "fsl,dpa-ethernet")) { port_cell_idx = of_get_property(rx_node, "cell-index", &lenp); if (!port_cell_idx) { - FMAN_ERR(-ENXIO, - "%s: no cell-index for port\n", mname); + FMAN_ERR(-ENXIO, "%s: no cell-index for port", mname); return -ENXIO; } assert(lenp == sizeof(*port_cell_idx)); @@ -305,8 +304,7 @@ fman_if_init(const struct device_node *dpa_node) ext_args_cell_idx = of_get_property(ext_args_node, "cell-index", &lenp); if (!ext_args_cell_idx) { - FMAN_ERR(-ENXIO, - "%s: no cell-index for ext args\n", + FMAN_ERR(-ENXIO, "%s: no cell-index for ext args", mname); return -ENXIO; } @@ -343,7 +341,7 @@ fman_if_init(const struct device_node *dpa_node) /* Allocate an object for this network interface */ __if = rte_malloc(NULL, sizeof(*__if), RTE_CACHE_LINE_SIZE); if (!__if) { - FMAN_ERR(-ENOMEM, "malloc(%zu)\n", sizeof(*__if)); + FMAN_ERR(-ENOMEM, "malloc(%zu)", sizeof(*__if)); goto err; } memset(__if, 0, sizeof(*__if)); @@ -356,12 +354,12 @@ fman_if_init(const struct device_node *dpa_node) /* Map the CCSR regs for the MAC node */ regs_addr = of_get_address(mac_node, 0, &__if->regs_size, NULL); if (!regs_addr) { - FMAN_ERR(-EINVAL, "of_get_address(%s)\n", mname); + FMAN_ERR(-EINVAL, "of_get_address(%s)", mname); goto err; } phys_addr = of_translate_address(mac_node, regs_addr); if (!phys_addr) { - FMAN_ERR(-EINVAL, "of_translate_address(%s, %p)\n", + FMAN_ERR(-EINVAL, "of_translate_address(%s, %p)", mname, regs_addr); goto err; } @@ -369,7 +367,7 @@ fman_if_init(const struct device_node *dpa_node) PROT_READ | PROT_WRITE, MAP_SHARED, fman_ccsr_map_fd, phys_addr); if (__if->ccsr_map == MAP_FAILED) { - FMAN_ERR(-errno, "mmap(0x%"PRIx64")\n", phys_addr); + FMAN_ERR(-errno, "mmap(0x%"PRIx64")", phys_addr); goto err; } na = of_n_addr_cells(mac_node); @@ -380,13 +378,13 @@ fman_if_init(const struct device_node *dpa_node) fman_node = of_get_parent(mac_node); na = of_n_addr_cells(mac_node); if (!fman_node) { - FMAN_ERR(-ENXIO, "of_get_parent(%s)\n", mname); + FMAN_ERR(-ENXIO, "of_get_parent(%s)", mname); goto err; } fname = fman_node->full_name; cell_idx = of_get_property(fman_node, "cell-index", &lenp); if (!cell_idx) { - FMAN_ERR(-ENXIO, "%s: no cell-index)\n", fname); + FMAN_ERR(-ENXIO, "%s: no cell-index)", fname); goto err; } assert(lenp == sizeof(*cell_idx)); @@ -395,7 +393,7 @@ fman_if_init(const struct device_node *dpa_node) if (!get_once) { _errno = fman_get_ip_rev(fman_node); if (_errno) { - FMAN_ERR(-ENXIO, "%s: ip_rev is not available\n", + FMAN_ERR(-ENXIO, "%s: ip_rev is not available", fname); goto err; } @@ -425,7 +423,7 @@ fman_if_init(const struct device_node *dpa_node) char_prop = of_get_property(mac_node, "phy-connection-type", NULL); if (!char_prop) { - printf("memac: unknown MII type assuming 1G\n"); + FMAN_ERR(-EINVAL, "memac: unknown MII type assuming 1G"); /* Right now forcing memac to 1g in case of error*/ __if->__if.mac_type = fman_mac_1g; } else { @@ -440,7 +438,7 @@ fman_if_init(const struct device_node *dpa_node) __if->__if.mac_type = fman_mac_10g; } } else { - FMAN_ERR(-EINVAL, "%s: unknown MAC type\n", mname); + FMAN_ERR(-EINVAL, "%s: unknown MAC type", mname); goto err; } @@ -463,7 +461,7 @@ fman_if_init(const struct device_node *dpa_node) mac_addr = of_get_property(mac_node, "local-mac-address", &lenp); if (!mac_addr) { - FMAN_ERR(-EINVAL, "%s: no local-mac-address\n", + FMAN_ERR(-EINVAL, "%s: no local-mac-address", mname); goto err; } @@ -473,19 +471,19 @@ fman_if_init(const struct device_node *dpa_node) tx_channel_id = of_get_property(tx_node, "fsl,qman-channel-id", &lenp); if (!tx_channel_id) { - FMAN_ERR(-EINVAL, "%s: no fsl-qman-channel-id\n", + FMAN_ERR(-EINVAL, "%s: no fsl-qman-channel-id", tx_node->full_name); goto err; } regs_addr = of_get_address(rx_node, 0, &__if->regs_size, NULL); if (!regs_addr) { - FMAN_ERR(-EINVAL, "of_get_address(%s)\n", mname); + FMAN_ERR(-EINVAL, "of_get_address(%s)", mname); goto err; } phys_addr = of_translate_address(rx_node, regs_addr); if (!phys_addr) { - FMAN_ERR(-EINVAL, "of_translate_address(%s, %p)\n", + FMAN_ERR(-EINVAL, "of_translate_address(%s, %p)", mname, regs_addr); goto err; } @@ -493,7 +491,7 @@ fman_if_init(const struct device_node *dpa_node) PROT_READ | PROT_WRITE, MAP_SHARED, fman_ccsr_map_fd, phys_addr); if (__if->bmi_map == MAP_FAILED) { - FMAN_ERR(-errno, "mmap(0x%"PRIx64")\n", phys_addr); + FMAN_ERR(-errno, "mmap(0x%"PRIx64")", phys_addr); goto err; } @@ -507,7 +505,7 @@ fman_if_init(const struct device_node *dpa_node) */ rx_phandle = of_get_property(dpa_node, rprop, &lenp); if (!rx_phandle) { - FMAN_ERR(-EINVAL, "%s: no fsl,qman-frame-queues-rx\n", dname); + FMAN_ERR(-EINVAL, "%s: no fsl,qman-frame-queues-rx", dname); goto err; } @@ -542,7 +540,7 @@ fman_if_init(const struct device_node *dpa_node) tx_phandle = of_get_property(dpa_node, "fsl,qman-frame-queues-tx", &lenp); if (!tx_phandle) { - FMAN_ERR(-EINVAL, "%s: no fsl,qman-frame-queues-tx\n", dname); + FMAN_ERR(-EINVAL, "%s: no fsl,qman-frame-queues-tx", dname); goto err; } @@ -562,7 +560,7 @@ fman_if_init(const struct device_node *dpa_node) pools_phandle = of_get_property(dpa_node, "fsl,bman-buffer-pools", &lenp); if (!pools_phandle) { - FMAN_ERR(-EINVAL, "%s: no fsl,bman-buffer-pools\n", dname); + FMAN_ERR(-EINVAL, "%s: no fsl,bman-buffer-pools", dname); goto err; } /* For each pool, parse the corresponding node and add a pool object @@ -578,13 +576,13 @@ fman_if_init(const struct device_node *dpa_node) /* Allocate an object for the pool */ bpool = rte_malloc(NULL, sizeof(*bpool), RTE_CACHE_LINE_SIZE); if (!bpool) { - FMAN_ERR(-ENOMEM, "malloc(%zu)\n", sizeof(*bpool)); + FMAN_ERR(-ENOMEM, "malloc(%zu)", sizeof(*bpool)); goto err; } /* Find the pool node */ pool_node = of_find_node_by_phandle(*pools_phandle); if (!pool_node) { - FMAN_ERR(-ENXIO, "%s: bad fsl,bman-buffer-pools\n", + FMAN_ERR(-ENXIO, "%s: bad fsl,bman-buffer-pools", dname); rte_free(bpool); goto err; @@ -593,7 +591,7 @@ fman_if_init(const struct device_node *dpa_node) /* Extract the BPID property */ prop = of_get_property(pool_node, "fsl,bpid", &proplen); if (!prop) { - FMAN_ERR(-EINVAL, "%s: no fsl,bpid\n", pname); + FMAN_ERR(-EINVAL, "%s: no fsl,bpid", pname); rte_free(bpool); goto err; } @@ -691,7 +689,7 @@ fman_init(void) for_each_child_node(parent_node, dpa_node) { _errno = fman_if_init(dpa_node); if (_errno) { - FMAN_ERR(_errno, "if_init(%s)\n", dpa_node->full_name); + FMAN_ERR(_errno, "if_init(%s)", dpa_node->full_name); goto err; } } diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c index 5d4352bb3c..e483428ddc 100644 --- a/drivers/bus/dpaa/dpaa_bus.c +++ b/drivers/bus/dpaa/dpaa_bus.c @@ -326,7 +326,7 @@ int rte_dpaa_portal_init(void *arg) dpaa_seqn_dynfield_offset = rte_mbuf_dynfield_register(&dpaa_seqn_dynfield_desc); if (dpaa_seqn_dynfield_offset < 0) { - DPAA_BUS_LOG(ERR, "Failed to register mbuf field for dpaa sequence number\n"); + DPAA_BUS_LOG(ERR, "Failed to register mbuf field for dpaa sequence number"); return -rte_errno; } @@ -673,7 +673,7 @@ rte_dpaa_bus_probe(void) if (dev->device_type == FSL_DPAA_ETH) { ret = rte_dpaa_setup_intr(dev->intr_handle); if (ret) - DPAA_BUS_ERR("Error setting up interrupt.\n"); + DPAA_BUS_ERR("Error setting up interrupt."); } } @@ -734,13 +734,13 @@ rte_dpaa_find_device(const struct rte_device *start, rte_dev_cmp_t cmp, while (dev != NULL) { if (cmp(&dev->device, data) == 0) { - DPAA_BUS_DEBUG("Found dev=(%s)\n", dev->device.name); + DPAA_BUS_DEBUG("Found dev=(%s)", dev->device.name); return &dev->device; } dev = TAILQ_NEXT(dev, next); } - DPAA_BUS_DEBUG("Unable to find any device\n"); + DPAA_BUS_DEBUG("Unable to find any device"); return NULL; } @@ -786,14 +786,14 @@ dpaa_bus_dev_iterate(const void *start, const char *str, /* Expectation is that device would be name=device_name */ if (strncmp(str, "name=", 5) != 0) { - DPAA_BUS_DEBUG("Invalid device string (%s)\n", str); + DPAA_BUS_DEBUG("Invalid device string (%s)", str); return NULL; } /* Now that name=device_name format is available, split */ dup = strdup(str); if (dup == NULL) { - DPAA_BUS_DEBUG("Dup string (%s) failed!\n", str); + DPAA_BUS_DEBUG("Dup string (%s) failed!", str); return NULL; } dev_name = dup + strlen("name="); -- 2.25.1 ^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v3 3/3] drivers: replace printf with fprintf for debug functions 2024-07-02 13:08 ` [PATCH v3 1/3] " Hemant Agrawal 2024-07-02 13:08 ` [PATCH v3 2/3] bus/dpaa: remove double newline Hemant Agrawal @ 2024-07-02 13:08 ` Hemant Agrawal 2024-07-03 10:41 ` [PATCH v3 1/3] drivers: replace printf with log macros David Marchand 2024-07-03 12:16 ` [PATCH v4 " Hemant Agrawal 3 siblings, 0 replies; 22+ messages in thread From: Hemant Agrawal @ 2024-07-02 13:08 UTC (permalink / raw) To: dev, thomas, stephen, david.marchand This patch replaces simple printf with fprintf for debug dump related functions for various NXP dpaaX related drivers. Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com> --- drivers/bus/dpaa/base/fman/netcfg_layer.c | 22 +++---- drivers/bus/dpaa/dpaa_bus.c | 2 +- drivers/bus/dpaa/include/netcfg.h | 2 +- drivers/crypto/caam_jr/caam_jr.c | 4 +- drivers/crypto/caam_jr/caam_jr_desc.h | 4 +- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 32 +++++----- drivers/crypto/dpaa_sec/dpaa_sec.c | 62 +++++++++---------- drivers/net/dpaa2/dpaa2_flow.c | 66 +++++++++++---------- 8 files changed, 98 insertions(+), 96 deletions(-) diff --git a/drivers/bus/dpaa/base/fman/netcfg_layer.c b/drivers/bus/dpaa/base/fman/netcfg_layer.c index 6a405c984d..57d87afcb0 100644 --- a/drivers/bus/dpaa/base/fman/netcfg_layer.c +++ b/drivers/bus/dpaa/base/fman/netcfg_layer.c @@ -29,37 +29,37 @@ static int skfd = -1; #ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER void -dump_netcfg(struct netcfg_info *cfg_ptr) +dump_netcfg(struct netcfg_info *cfg_ptr, FILE *f) { int i; - printf(".......... DPAA Configuration ..........\n\n"); + fprintf(f, ".......... DPAA Configuration ..........\n\n"); /* Network interfaces */ - printf("Network interfaces: %d\n", cfg_ptr->num_ethports); + fprintf(f, "Network interfaces: %d\n", cfg_ptr->num_ethports); for (i = 0; i < cfg_ptr->num_ethports; i++) { struct fman_if_bpool *bpool; struct fm_eth_port_cfg *p_cfg = &cfg_ptr->port_cfg[i]; struct fman_if *__if = p_cfg->fman_if; - printf("\n+ Fman %d, MAC %d (%s);\n", + fprintf(f, "\n+ Fman %d, MAC %d (%s);\n", __if->fman_idx, __if->mac_idx, (__if->mac_type == fman_mac_1g) ? "1G" : (__if->mac_type == fman_mac_2_5g) ? "2.5G" : "10G"); - printf("\tmac_addr: " RTE_ETHER_ADDR_PRT_FMT "\n", + fprintf(f, "\tmac_addr: " RTE_ETHER_ADDR_PRT_FMT "\n", RTE_ETHER_ADDR_BYTES(&__if->mac_addr)); - printf("\ttx_channel_id: 0x%02x\n", + fprintf(f, "\ttx_channel_id: 0x%02x\n", __if->tx_channel_id); - printf("\tfqid_rx_def: 0x%x\n", p_cfg->rx_def); - printf("\tfqid_rx_err: 0x%x\n", __if->fqid_rx_err); + fprintf(f, "\tfqid_rx_def: 0x%x\n", p_cfg->rx_def); + fprintf(f, "\tfqid_rx_err: 0x%x\n", __if->fqid_rx_err); - printf("\tfqid_tx_err: 0x%x\n", __if->fqid_tx_err); - printf("\tfqid_tx_confirm: 0x%x\n", __if->fqid_tx_confirm); + fprintf(f, "\tfqid_tx_err: 0x%x\n", __if->fqid_tx_err); + fprintf(f, "\tfqid_tx_confirm: 0x%x\n", __if->fqid_tx_confirm); fman_if_for_each_bpool(bpool, __if) - printf("\tbuffer pool: (bpid=%d, count=%"PRId64 + fprintf(f, "\tbuffer pool: (bpid=%d, count=%"PRId64 " size=%"PRId64", addr=0x%"PRIx64")\n", bpool->bpid, bpool->count, bpool->size, bpool->addr); diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c index e483428ddc..8ce93abd84 100644 --- a/drivers/bus/dpaa/dpaa_bus.c +++ b/drivers/bus/dpaa/dpaa_bus.c @@ -586,7 +586,7 @@ rte_dpaa_bus_dev_build(void) } #ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER - dump_netcfg(dpaa_netcfg); + dump_netcfg(dpaa_netcfg, stdout); #endif DPAA_BUS_LOG(DEBUG, "Number of ethernet devices = %d", diff --git a/drivers/bus/dpaa/include/netcfg.h b/drivers/bus/dpaa/include/netcfg.h index 5bdcc9186a..ebbbaf6d10 100644 --- a/drivers/bus/dpaa/include/netcfg.h +++ b/drivers/bus/dpaa/include/netcfg.h @@ -60,7 +60,7 @@ void netcfg_release(struct netcfg_info *cfg_ptr); /* cfg_ptr: configuration information pointer. * This function dumps configuration data to stdout. */ -void dump_netcfg(struct netcfg_info *cfg_ptr); +void dump_netcfg(struct netcfg_info *cfg_ptr, FILE *f); #endif #endif /* __NETCFG_H */ diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c index fb9ac9cb30..c836cc128a 100644 --- a/drivers/crypto/caam_jr/caam_jr.c +++ b/drivers/crypto/caam_jr/caam_jr.c @@ -1410,9 +1410,9 @@ caam_jr_enqueue_op(struct rte_crypto_op *op, struct caam_jr_qp *qp) rte_pktmbuf_mtod(op->sym->m_src, void *), rte_pktmbuf_data_len(op->sym->m_src)); - printf("\n JD before conversion\n"); + fprintf(stdout, "\n JD before conversion\n"); for (i = 0; i < 12; i++) - printf("\n 0x%08x", ctx->jobdes.desc[i]); + fprintf(stdout, "\n 0x%08x", ctx->jobdes.desc[i]); #endif CAAM_JR_DP_DEBUG("Jr[%p] pi[%d] ci[%d].Before sending desc", diff --git a/drivers/crypto/caam_jr/caam_jr_desc.h b/drivers/crypto/caam_jr/caam_jr_desc.h index c85278bf1e..a4507613be 100644 --- a/drivers/crypto/caam_jr/caam_jr_desc.h +++ b/drivers/crypto/caam_jr/caam_jr_desc.h @@ -110,13 +110,13 @@ ((struct descriptor_header_s *)(descriptor))->command.jd.desclen) /* Helper macro for dumping the hex representation of a descriptor */ -#define SEC_DUMP_DESC(descriptor) { \ +#define SEC_DUMP_DESC(descriptor, f) { \ int __i; \ CAAM_JR_INFO("Des@ 0x%08x\n", (uint32_t)((uint32_t *)(descriptor)));\ for (__i = 0; \ __i < SEC_GET_DESC_LEN(descriptor); \ __i++) { \ - printf("0x%08x: 0x%08x\n", \ + fprintf(f, "0x%08x: 0x%08x\n", \ (uint32_t)(((uint32_t *)(descriptor)) + __i), \ *(((uint32_t *)(descriptor)) + __i)); \ } \ diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c index 1cae6c4505..4c5b98d9be 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -1621,7 +1621,7 @@ sec_fd_to_mbuf(const struct qbman_fd *fd, struct dpaa2_sec_qp *qp) } static void -dpaa2_sec_dump(struct rte_crypto_op *op) +dpaa2_sec_dump(struct rte_crypto_op *op, FILE *f) { int i; dpaa2_sec_session *sess = NULL; @@ -1640,18 +1640,18 @@ dpaa2_sec_dump(struct rte_crypto_op *op) goto mbuf_dump; priv = (struct ctxt_priv *)sess->ctxt; - printf("\n****************************************\n" + fprintf(f, "\n****************************************\n" "session params:\n\tContext type:\t%d\n\tDirection:\t%s\n" "\tCipher alg:\t%d\n\tAuth alg:\t%d\n\tAead alg:\t%d\n" "\tCipher key len:\t%zd\n", sess->ctxt_type, (sess->dir == DIR_ENC) ? "DIR_ENC" : "DIR_DEC", sess->cipher_alg, sess->auth_alg, sess->aead_alg, sess->cipher_key.length); - rte_hexdump(stdout, "cipher key", sess->cipher_key.data, + rte_hexdump(f, "cipher key", sess->cipher_key.data, sess->cipher_key.length); - rte_hexdump(stdout, "auth key", sess->auth_key.data, + rte_hexdump(f, "auth key", sess->auth_key.data, sess->auth_key.length); - printf("\tAuth key len:\t%zd\n\tIV len:\t\t%d\n\tIV offset:\t%d\n" + fprintf(f, "\tAuth key len:\t%zd\n\tIV len:\t\t%d\n\tIV offset:\t%d\n" "\tdigest length:\t%d\n\tstatus:\t\t%d\n\taead auth only" " len:\t%d\n\taead cipher text:\t%d\n", sess->auth_key.length, sess->iv.length, sess->iv.offset, @@ -1659,7 +1659,7 @@ dpaa2_sec_dump(struct rte_crypto_op *op) sess->ext_params.aead_ctxt.auth_only_len, sess->ext_params.aead_ctxt.auth_cipher_text); #ifdef RTE_LIB_SECURITY - printf("PDCP session params:\n" + fprintf(f, "PDCP session params:\n" "\tDomain:\t\t%d\n\tBearer:\t\t%d\n\tpkt_dir:\t%d\n\thfn_ovd:" "\t%d\n\tsn_size:\t%d\n\thfn_ovd_offset:\t%d\n\thfn:\t\t%d\n" "\thfn_threshold:\t0x%x\n", sess->pdcp.domain, @@ -1669,29 +1669,29 @@ dpaa2_sec_dump(struct rte_crypto_op *op) #endif bufsize = (uint8_t)priv->flc_desc[0].flc.word1_sdl; - printf("Descriptor Dump:\n"); + fprintf(f, "Descriptor Dump:\n"); for (i = 0; i < bufsize; i++) - printf("\tDESC[%d]:0x%x\n", i, priv->flc_desc[0].desc[i]); + fprintf(f, "\tDESC[%d]:0x%x\n", i, priv->flc_desc[0].desc[i]); - printf("\n"); + fprintf(f, "\n"); mbuf_dump: sym_op = op->sym; if (sym_op->m_src) { - printf("Source mbuf:\n"); - rte_pktmbuf_dump(stdout, sym_op->m_src, sym_op->m_src->data_len); + fprintf(f, "Source mbuf:\n"); + rte_pktmbuf_dump(f, sym_op->m_src, sym_op->m_src->data_len); } if (sym_op->m_dst) { - printf("Destination mbuf:\n"); - rte_pktmbuf_dump(stdout, sym_op->m_dst, sym_op->m_dst->data_len); + fprintf(f, "Destination mbuf:\n"); + rte_pktmbuf_dump(f, sym_op->m_dst, sym_op->m_dst->data_len); } - printf("Session address = %p\ncipher offset: %d, length: %d\n" + fprintf(f, "Session address = %p\ncipher offset: %d, length: %d\n" "auth offset: %d, length: %d\n aead offset: %d, length: %d\n" , sym_op->session, sym_op->cipher.data.offset, sym_op->cipher.data.length, sym_op->auth.data.offset, sym_op->auth.data.length, sym_op->aead.data.offset, sym_op->aead.data.length); - printf("\n"); + fprintf(f, "\n"); } @@ -1951,7 +1951,7 @@ dpaa2_sec_dequeue_burst(void *qp, struct rte_crypto_op **ops, DPAA2_SEC_DP_ERR("SEC returned Error - %x\n", fd->simple.frc); if (dpaa2_sec_dp_dump > DPAA2_SEC_DP_ERR_DUMP) - dpaa2_sec_dump(ops[num_rx]); + dpaa2_sec_dump(ops[num_rx], stdout); } dpaa2_qp->rx_vq.err_pkts += 1; diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c index 44528eaf7f..7aa163330a 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.c +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c @@ -654,7 +654,7 @@ dpaa_sec_prep_cdb(dpaa_sec_session *ses) } static void -dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp) +dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp, FILE *f) { struct dpaa_sec_job *job = &ctx->job; struct rte_crypto_op *op = ctx->op; @@ -678,9 +678,9 @@ dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp) cdb = &sess->cdb; rte_memcpy(&c_cdb, cdb, sizeof(struct sec_cdb)); #ifdef RTE_LIB_SECURITY - printf("\nsession protocol type = %d\n", sess->proto_alg); + fprintf(f, "\nsession protocol type = %d\n", sess->proto_alg); #endif - printf("\n****************************************\n" + fprintf(f, "\n****************************************\n" "session params:\n\tContext type:\t%d\n\tDirection:\t%s\n" "\tCipher alg:\t%d\n\tAuth alg:\t%d\n\tAead alg:\t%d\n" "\tCipher key len:\t%"PRIu64"\n\tCipher alg:\t%d\n" @@ -689,11 +689,11 @@ dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp) sess->cipher_alg, sess->auth_alg, sess->aead_alg, (uint64_t)sess->cipher_key.length, sess->cipher_key.alg, sess->cipher_key.algmode); - rte_hexdump(stdout, "cipher key", sess->cipher_key.data, + rte_hexdump(f, "cipher key", sess->cipher_key.data, sess->cipher_key.length); - rte_hexdump(stdout, "auth key", sess->auth_key.data, + rte_hexdump(f, "auth key", sess->auth_key.data, sess->auth_key.length); - printf("\tAuth key len:\t%"PRIu64"\n\tAuth alg:\t%d\n" + fprintf(f, "\tAuth key len:\t%"PRIu64"\n\tAuth alg:\t%d\n" "\tAuth algmode:\t%d\n\tIV len:\t\t%d\n\tIV offset:\t%d\n" "\tdigest length:\t%d\n\tauth only len:\t\t%d\n" "\taead cipher text:\t%d\n", @@ -703,7 +703,7 @@ dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp) sess->digest_length, sess->auth_only_len, sess->auth_cipher_text); #ifdef RTE_LIB_SECURITY - printf("PDCP session params:\n" + fprintf(f, "PDCP session params:\n" "\tDomain:\t\t%d\n\tBearer:\t\t%d\n\tpkt_dir:\t%d\n\thfn_ovd:" "\t%d\n\tsn_size:\t%d\n\tsdap_enabled:\t%d\n\thfn_ovd_offset:" "\t%d\n\thfn:\t\t%d\n" @@ -717,63 +717,63 @@ dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp) c_cdb.sh_hdr.lo.word = rte_be_to_cpu_32(c_cdb.sh_hdr.lo.word); bufsize = c_cdb.sh_hdr.hi.field.idlen; - printf("cdb = %p\n\n", cdb); - printf("Descriptor size = %d\n", bufsize); + fprintf(f, "cdb = %p\n\n", cdb); + fprintf(f, "Descriptor size = %d\n", bufsize); int m; for (m = 0; m < bufsize; m++) - printf("0x%x\n", rte_be_to_cpu_32(c_cdb.sh_desc[m])); + fprintf(f, "0x%x\n", rte_be_to_cpu_32(c_cdb.sh_desc[m])); - printf("\n"); + fprintf(f, "\n"); mbuf_dump: sym_op = op->sym; if (sym_op->m_src) { - printf("Source mbuf:\n"); - rte_pktmbuf_dump(stdout, sym_op->m_src, + fprintf(f, "Source mbuf:\n"); + rte_pktmbuf_dump(f, sym_op->m_src, sym_op->m_src->data_len); } if (sym_op->m_dst) { - printf("Destination mbuf:\n"); - rte_pktmbuf_dump(stdout, sym_op->m_dst, + fprintf(f, "Destination mbuf:\n"); + rte_pktmbuf_dump(f, sym_op->m_dst, sym_op->m_dst->data_len); } - printf("Session address = %p\ncipher offset: %d, length: %d\n" + fprintf(f, "Session address = %p\ncipher offset: %d, length: %d\n" "auth offset: %d, length: %d\n aead offset: %d, length: %d\n", sym_op->session, sym_op->cipher.data.offset, sym_op->cipher.data.length, sym_op->auth.data.offset, sym_op->auth.data.length, sym_op->aead.data.offset, sym_op->aead.data.length); - printf("\n"); + fprintf(f, "\n"); - printf("******************************************************\n"); - printf("ctx info:\n"); - printf("job->sg[0] output info:\n"); + fprintf(f, "******************************************************\n"); + fprintf(f, "ctx info:\n"); + fprintf(f, "job->sg[0] output info:\n"); memcpy(&sg[0], &job->sg[0], sizeof(sg[0])); - printf("\taddr = %"PRIx64",\n\tlen = %d,\n\tfinal = %d,\n\textension = %d" + fprintf(f, "\taddr = %"PRIx64",\n\tlen = %d,\n\tfinal = %d,\n\textension = %d" "\n\tbpid = %d\n\toffset = %d\n", (uint64_t)sg[0].addr, sg[0].length, sg[0].final, sg[0].extension, sg[0].bpid, sg[0].offset); - printf("\njob->sg[1] input info:\n"); + fprintf(f, "\njob->sg[1] input info:\n"); memcpy(&sg[1], &job->sg[1], sizeof(sg[1])); hw_sg_to_cpu(&sg[1]); - printf("\taddr = %"PRIx64",\n\tlen = %d,\n\tfinal = %d,\n\textension = %d" + fprintf(f, "\taddr = %"PRIx64",\n\tlen = %d,\n\tfinal = %d,\n\textension = %d" "\n\tbpid = %d\n\toffset = %d\n", (uint64_t)sg[1].addr, sg[1].length, sg[1].final, sg[1].extension, sg[1].bpid, sg[1].offset); - printf("\nctx pool addr = %p\n", ctx->ctx_pool); + fprintf(f, "\nctx pool addr = %p\n", ctx->ctx_pool); if (ctx->ctx_pool) - printf("ctx pool available counts = %d\n", + fprintf(f, "ctx pool available counts = %d\n", rte_mempool_avail_count(ctx->ctx_pool)); - printf("\nop pool addr = %p\n", op->mempool); + fprintf(f, "\nop pool addr = %p\n", op->mempool); if (op->mempool) - printf("op pool available counts = %d\n", + fprintf(f, "op pool available counts = %d\n", rte_mempool_avail_count(op->mempool)); - printf("********************************************************\n"); - printf("Queue data:\n"); - printf("\tFQID = 0x%x\n\tstate = %d\n\tnb_desc = %d\n" + fprintf(f, "********************************************************\n"); + fprintf(f, "Queue data:\n"); + fprintf(f, "\tFQID = 0x%x\n\tstate = %d\n\tnb_desc = %d\n" "\tctx_pool = %p\n\trx_pkts = %d\n\ttx_pkts" "= %d\n\trx_errs = %d\n\ttx_errs = %d\n\n", qp->outq.fqid, qp->outq.state, qp->outq.nb_desc, @@ -852,7 +852,7 @@ dpaa_sec_deq(struct dpaa_sec_qp *qp, struct rte_crypto_op **ops, int nb_ops) DPAA_SEC_DP_WARN("SEC return err:0x%x\n", ctx->fd_status); if (dpaa_sec_dp_dump > DPAA_SEC_DP_ERR_DUMP) - dpaa_sec_dump(ctx, qp); + dpaa_sec_dump(ctx, qp, stdout); } op->status = RTE_CRYPTO_OP_STATUS_ERROR; } diff --git a/drivers/net/dpaa2/dpaa2_flow.c b/drivers/net/dpaa2/dpaa2_flow.c index eec7e60650..6c7bac4d48 100644 --- a/drivers/net/dpaa2/dpaa2_flow.c +++ b/drivers/net/dpaa2/dpaa2_flow.c @@ -236,7 +236,7 @@ static inline void dpaa2_prot_field_string( } static inline void dpaa2_flow_qos_table_extracts_log( - const struct dpaa2_dev_priv *priv) + const struct dpaa2_dev_priv *priv, FILE *f) { int idx; char string[32]; @@ -244,7 +244,7 @@ static inline void dpaa2_flow_qos_table_extracts_log( if (!dpaa2_flow_control_log) return; - printf("Setup QoS table: number of extracts: %d\r\n", + fprintf(f, "Setup QoS table: number of extracts: %d\r\n", priv->extract.qos_key_extract.dpkg.num_extracts); for (idx = 0; idx < priv->extract.qos_key_extract.dpkg.num_extracts; idx++) { @@ -253,15 +253,15 @@ static inline void dpaa2_flow_qos_table_extracts_log( priv->extract.qos_key_extract.dpkg.extracts[idx] .extract.from_hdr.field, string); - printf("%s", string); + fprintf(f, "%s", string); if ((idx + 1) < priv->extract.qos_key_extract.dpkg.num_extracts) - printf(" / "); + fprintf(f, " / "); } - printf("\r\n"); + fprintf(f, "\r\n"); } static inline void dpaa2_flow_fs_table_extracts_log( - const struct dpaa2_dev_priv *priv, int tc_id) + const struct dpaa2_dev_priv *priv, int tc_id, FILE *f) { int idx; char string[32]; @@ -269,7 +269,7 @@ static inline void dpaa2_flow_fs_table_extracts_log( if (!dpaa2_flow_control_log) return; - printf("Setup FS table: number of extracts of TC[%d]: %d\r\n", + fprintf(f, "Setup FS table: number of extracts of TC[%d]: %d\r\n", tc_id, priv->extract.tc_key_extract[tc_id] .dpkg.num_extracts); for (idx = 0; idx < priv->extract.tc_key_extract[tc_id] @@ -279,16 +279,16 @@ static inline void dpaa2_flow_fs_table_extracts_log( priv->extract.tc_key_extract[tc_id].dpkg.extracts[idx] .extract.from_hdr.field, string); - printf("%s", string); + fprintf(f, "%s", string); if ((idx + 1) < priv->extract.tc_key_extract[tc_id] .dpkg.num_extracts) - printf(" / "); + fprintf(f, " / "); } - printf("\r\n"); + fprintf(f, "\r\n"); } static inline void dpaa2_flow_qos_entry_log( - const char *log_info, const struct rte_flow *flow, int qos_index) + const char *log_info, const struct rte_flow *flow, int qos_index, FILE *f) { int idx; uint8_t *key, *mask; @@ -296,27 +296,27 @@ static inline void dpaa2_flow_qos_entry_log( if (!dpaa2_flow_control_log) return; - printf("\r\n%s QoS entry[%d] for TC[%d], extracts size is %d\r\n", + fprintf(f, "\r\n%s QoS entry[%d] for TC[%d], extracts size is %d\r\n", log_info, qos_index, flow->tc_id, flow->qos_real_key_size); key = (uint8_t *)(size_t)flow->qos_rule.key_iova; mask = (uint8_t *)(size_t)flow->qos_rule.mask_iova; - printf("key:\r\n"); + fprintf(f, "key:\r\n"); for (idx = 0; idx < flow->qos_real_key_size; idx++) - printf("%02x ", key[idx]); + fprintf(f, "%02x ", key[idx]); - printf("\r\nmask:\r\n"); + fprintf(f, "\r\nmask:\r\n"); for (idx = 0; idx < flow->qos_real_key_size; idx++) - printf("%02x ", mask[idx]); + fprintf(f, "%02x ", mask[idx]); - printf("\r\n%s QoS ipsrc: %d, ipdst: %d\r\n", log_info, + fprintf(f, "\r\n%s QoS ipsrc: %d, ipdst: %d\r\n", log_info, flow->ipaddr_rule.qos_ipsrc_offset, flow->ipaddr_rule.qos_ipdst_offset); } static inline void dpaa2_flow_fs_entry_log( - const char *log_info, const struct rte_flow *flow) + const char *log_info, const struct rte_flow *flow, FILE *f) { int idx; uint8_t *key, *mask; @@ -324,21 +324,21 @@ static inline void dpaa2_flow_fs_entry_log( if (!dpaa2_flow_control_log) return; - printf("\r\n%s FS/TC entry[%d] of TC[%d], extracts size is %d\r\n", + fprintf(f, "\r\n%s FS/TC entry[%d] of TC[%d], extracts size is %d\r\n", log_info, flow->tc_index, flow->tc_id, flow->fs_real_key_size); key = (uint8_t *)(size_t)flow->fs_rule.key_iova; mask = (uint8_t *)(size_t)flow->fs_rule.mask_iova; - printf("key:\r\n"); + fprintf(f, "key:\r\n"); for (idx = 0; idx < flow->fs_real_key_size; idx++) - printf("%02x ", key[idx]); + fprintf(f, "%02x ", key[idx]); - printf("\r\nmask:\r\n"); + fprintf(f, "\r\nmask:\r\n"); for (idx = 0; idx < flow->fs_real_key_size; idx++) - printf("%02x ", mask[idx]); + fprintf(f, "%02x ", mask[idx]); - printf("\r\n%s FS ipsrc: %d, ipdst: %d\r\n", log_info, + fprintf(f, "\r\n%s FS ipsrc: %d, ipdst: %d\r\n", log_info, flow->ipaddr_rule.fs_ipsrc_offset, flow->ipaddr_rule.fs_ipdst_offset); } @@ -3017,7 +3017,7 @@ dpaa2_flow_entry_update( qos_index = curr->tc_id * priv->fs_entries + curr->tc_index; - dpaa2_flow_qos_entry_log("Before update", curr, qos_index); + dpaa2_flow_qos_entry_log("Before update", curr, qos_index, stdout); if (priv->num_rx_tc > 1) { ret = dpni_remove_qos_entry(dpni, CMD_PRI_LOW, @@ -3124,7 +3124,7 @@ dpaa2_flow_entry_update( curr->qos_rule.key_size = FIXED_ENTRY_SIZE; - dpaa2_flow_qos_entry_log("Start update", curr, qos_index); + dpaa2_flow_qos_entry_log("Start update", curr, qos_index, stdout); if (priv->num_rx_tc > 1) { ret = dpni_add_qos_entry(dpni, CMD_PRI_LOW, @@ -3142,7 +3142,7 @@ dpaa2_flow_entry_update( continue; } - dpaa2_flow_fs_entry_log("Before update", curr); + dpaa2_flow_fs_entry_log("Before update", curr, stdout); extend = -1; ret = dpni_remove_fs_entry(dpni, CMD_PRI_LOW, @@ -3237,7 +3237,7 @@ dpaa2_flow_entry_update( curr->fs_real_key_size += extend; curr->fs_rule.key_size = FIXED_ENTRY_SIZE; - dpaa2_flow_fs_entry_log("Start update", curr); + dpaa2_flow_fs_entry_log("Start update", curr, stdout); ret = dpni_add_fs_entry(dpni, CMD_PRI_LOW, priv->token, curr->tc_id, curr->tc_index, @@ -3541,7 +3541,8 @@ dpaa2_generic_flow_set(struct rte_flow *flow, /* Configure FS table first*/ if (is_keycfg_configured & DPAA2_FS_TABLE_RECONFIGURE) { - dpaa2_flow_fs_table_extracts_log(priv, flow->tc_id); + dpaa2_flow_fs_table_extracts_log(priv, + flow->tc_id, stdout); if (dpkg_prepare_key_cfg( &priv->extract.tc_key_extract[flow->tc_id].dpkg, (uint8_t *)(size_t)priv->extract @@ -3580,7 +3581,7 @@ dpaa2_generic_flow_set(struct rte_flow *flow, /* Configure QoS table then.*/ if (is_keycfg_configured & DPAA2_QOS_TABLE_RECONFIGURE) { - dpaa2_flow_qos_table_extracts_log(priv); + dpaa2_flow_qos_table_extracts_log(priv, stdout); if (dpkg_prepare_key_cfg( &priv->extract.qos_key_extract.dpkg, (uint8_t *)(size_t)priv->extract.qos_extract_param) < 0) { @@ -3646,7 +3647,8 @@ dpaa2_generic_flow_set(struct rte_flow *flow, } flow->qos_rule.key_size = FIXED_ENTRY_SIZE; - dpaa2_flow_qos_entry_log("Start add", flow, qos_index); + dpaa2_flow_qos_entry_log("Start add", flow, + qos_index, stdout); ret = dpni_add_qos_entry(dpni, CMD_PRI_LOW, priv->token, &flow->qos_rule, @@ -3697,7 +3699,7 @@ dpaa2_generic_flow_set(struct rte_flow *flow, flow->fs_rule.key_size = FIXED_ENTRY_SIZE; - dpaa2_flow_fs_entry_log("Start add", flow); + dpaa2_flow_fs_entry_log("Start add", flow, stdout); ret = dpni_add_fs_entry(dpni, CMD_PRI_LOW, priv->token, flow->tc_id, flow->tc_index, -- 2.25.1 ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v3 1/3] drivers: replace printf with log macros 2024-07-02 13:08 ` [PATCH v3 1/3] " Hemant Agrawal 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 ` David Marchand 2024-07-03 12:02 ` Hemant Agrawal 2024-07-03 12:16 ` [PATCH v4 " Hemant Agrawal 3 siblings, 1 reply; 22+ messages in thread From: David Marchand @ 2024-07-03 10:41 UTC (permalink / raw) To: Hemant Agrawal; +Cc: dev, thomas, stephen Hello Hemant, On Tue, Jul 2, 2024 at 3:09 PM Hemant Agrawal <hemant.agrawal@nxp.com> wrote: [snip] > 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 This hunk should go to next patch. > > cdb->sh_hdr.hi.field.idlen = shared_desc_len; [snip] > 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"); DPAA_PMD_ERR appends a \n, so \n should be removed here. There are double \n in this driver prior to this patch, can you fix them too? It is probably worth checking other NXP drivers on this topic. > } > 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"); Idem. > } > } > [snip] > 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"); > } Indeed it is better to call this macro, but this macro is calling printf. I am ok with the change as this is under a debug build cflag, but I would prefer this debug code goes through rte_log in the future. -- David Marchand ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v3 1/3] drivers: replace printf with log macros 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 0 siblings, 1 reply; 22+ messages in thread From: Hemant Agrawal @ 2024-07-03 12:02 UTC (permalink / raw) To: David Marchand, Hemant Agrawal; +Cc: dev, thomas, stephen Hi David On 03-07-2024 16:11, David Marchand wrote: > Hello Hemant, > > On Tue, Jul 2, 2024 at 3:09 PM Hemant Agrawal <hemant.agrawal@nxp.com> wrote: > > [snip] > >> 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 > This hunk should go to next patch. will fix it in v4 >> cdb->sh_hdr.hi.field.idlen = shared_desc_len; > [snip] > >> 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"); > DPAA_PMD_ERR appends a \n, so \n should be removed here. > > There are double \n in this driver prior to this patch, can you fix them too? > It is probably worth checking other NXP drivers on this topic. will fix this in v4 and for the time being I am fixing it for dpaa set of drivers in 2nd patch of this series. Rest will follow as a separate patch. > >> } >> 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"); > Idem. ok > > >> } >> } >> > [snip] > >> 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"); >> } > Indeed it is better to call this macro, but this macro is calling printf. > I am ok with the change as this is under a debug build cflag, but I > would prefer this debug code goes through rte_log in the future. > > ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v3 1/3] drivers: replace printf with log macros 2024-07-03 12:02 ` Hemant Agrawal @ 2024-07-03 12:11 ` David Marchand 0 siblings, 0 replies; 22+ messages in thread From: David Marchand @ 2024-07-03 12:11 UTC (permalink / raw) To: Hemant Agrawal; +Cc: Hemant Agrawal, dev, thomas, stephen On Wed, Jul 3, 2024 at 2:03 PM Hemant Agrawal <hemant.agrawal@oss.nxp.com> wrote: > >> 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"); > > DPAA_PMD_ERR appends a \n, so \n should be removed here. > > > > There are double \n in this driver prior to this patch, can you fix them too? > > It is probably worth checking other NXP drivers on this topic. > will fix this in v4 and for the time being I am fixing it for dpaa set > of drivers in 2nd patch of this series. Rest will follow as a separate > patch. Ok, thanks. -- David Marchand ^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v4 1/3] drivers: replace printf with log macros 2024-07-02 13:08 ` [PATCH v3 1/3] " Hemant Agrawal ` (2 preceding siblings ...) 2024-07-03 10:41 ` [PATCH v3 1/3] drivers: replace printf with log macros David Marchand @ 2024-07-03 12:16 ` Hemant Agrawal 2024-07-03 12:16 ` [PATCH v4 2/3] drivers: dpaa: remove double newline Hemant Agrawal ` (2 more replies) 3 siblings, 3 replies; 22+ messages in thread From: Hemant Agrawal @ 2024-07-03 12:16 UTC (permalink / raw) To: dev, thomas, stephen, david.marchand 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 | 4 ++-- 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, 38 insertions(+), 39 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..dd59fe8384 100644 --- a/drivers/crypto/caam_jr/caam_jr.c +++ b/drivers/crypto/caam_jr/caam_jr.c @@ -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..093f9a8ff9 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"); else - printf("Failed to enable interrupt\n"); + DPAA_PMD_ERR("Failed to enable interrupt"); } 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"); } } 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 ^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v4 2/3] drivers: dpaa: remove double newline 2024-07-03 12:16 ` [PATCH v4 " Hemant Agrawal @ 2024-07-03 12:16 ` 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 2 siblings, 0 replies; 22+ messages in thread From: Hemant Agrawal @ 2024-07-03 12:16 UTC (permalink / raw) To: dev, thomas, stephen, david.marchand Remove duplicate newline `\n` from the debugging macros to avoid double `\n\n`. Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com> --- drivers/bus/dpaa/base/fman/fman.c | 58 ++++++++++++++--------------- drivers/bus/dpaa/dpaa_bus.c | 12 +++--- drivers/event/dpaa/dpaa_eventdev.c | 20 +++++----- drivers/mempool/dpaa/dpaa_mempool.c | 4 +- drivers/net/dpaa/dpaa_ethdev.c | 42 ++++++++++----------- drivers/net/dpaa/dpaa_flow.c | 4 +- drivers/net/dpaa/fmlib/fm_lib.c | 6 +-- drivers/net/dpaa/fmlib/fm_vsp.c | 10 ++--- 8 files changed, 77 insertions(+), 79 deletions(-) diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c index 953f7d7061..41195eb0a7 100644 --- a/drivers/bus/dpaa/base/fman/fman.c +++ b/drivers/bus/dpaa/base/fman/fman.c @@ -244,13 +244,13 @@ fman_if_init(const struct device_node *dpa_node) /* Obtain the MAC node used by this interface except macless */ mac_phandle = of_get_property(dpa_node, mprop, &lenp); if (!mac_phandle) { - FMAN_ERR(-EINVAL, "%s: no %s\n", dname, mprop); + FMAN_ERR(-EINVAL, "%s: no %s", dname, mprop); return -EINVAL; } assert(lenp == sizeof(phandle)); mac_node = of_find_node_by_phandle(*mac_phandle); if (!mac_node) { - FMAN_ERR(-ENXIO, "%s: bad 'fsl,fman-mac\n", dname); + FMAN_ERR(-ENXIO, "%s: bad 'fsl,fman-mac", dname); return -ENXIO; } mname = mac_node->full_name; @@ -262,19 +262,19 @@ fman_if_init(const struct device_node *dpa_node) ports_phandle = of_get_property(mac_node, "fsl,fman-ports", &lenp); if (!ports_phandle) { - FMAN_ERR(-EINVAL, "%s: no fsl,port-handles\n", + FMAN_ERR(-EINVAL, "%s: no fsl,port-handles", mname); return -EINVAL; } assert(lenp == (2 * sizeof(phandle))); rx_node = of_find_node_by_phandle(ports_phandle[0]); if (!rx_node) { - FMAN_ERR(-ENXIO, "%s: bad fsl,port-handle[0]\n", mname); + FMAN_ERR(-ENXIO, "%s: bad fsl,port-handle[0]", mname); return -ENXIO; } tx_node = of_find_node_by_phandle(ports_phandle[1]); if (!tx_node) { - FMAN_ERR(-ENXIO, "%s: bad fsl,port-handle[1]\n", mname); + FMAN_ERR(-ENXIO, "%s: bad fsl,port-handle[1]", mname); return -ENXIO; } @@ -282,8 +282,7 @@ fman_if_init(const struct device_node *dpa_node) if (of_device_is_compatible(dpa_node, "fsl,dpa-ethernet")) { port_cell_idx = of_get_property(rx_node, "cell-index", &lenp); if (!port_cell_idx) { - FMAN_ERR(-ENXIO, - "%s: no cell-index for port\n", mname); + FMAN_ERR(-ENXIO, "%s: no cell-index for port", mname); return -ENXIO; } assert(lenp == sizeof(*port_cell_idx)); @@ -305,8 +304,7 @@ fman_if_init(const struct device_node *dpa_node) ext_args_cell_idx = of_get_property(ext_args_node, "cell-index", &lenp); if (!ext_args_cell_idx) { - FMAN_ERR(-ENXIO, - "%s: no cell-index for ext args\n", + FMAN_ERR(-ENXIO, "%s: no cell-index for ext args", mname); return -ENXIO; } @@ -343,7 +341,7 @@ fman_if_init(const struct device_node *dpa_node) /* Allocate an object for this network interface */ __if = rte_malloc(NULL, sizeof(*__if), RTE_CACHE_LINE_SIZE); if (!__if) { - FMAN_ERR(-ENOMEM, "malloc(%zu)\n", sizeof(*__if)); + FMAN_ERR(-ENOMEM, "malloc(%zu)", sizeof(*__if)); goto err; } memset(__if, 0, sizeof(*__if)); @@ -356,12 +354,12 @@ fman_if_init(const struct device_node *dpa_node) /* Map the CCSR regs for the MAC node */ regs_addr = of_get_address(mac_node, 0, &__if->regs_size, NULL); if (!regs_addr) { - FMAN_ERR(-EINVAL, "of_get_address(%s)\n", mname); + FMAN_ERR(-EINVAL, "of_get_address(%s)", mname); goto err; } phys_addr = of_translate_address(mac_node, regs_addr); if (!phys_addr) { - FMAN_ERR(-EINVAL, "of_translate_address(%s, %p)\n", + FMAN_ERR(-EINVAL, "of_translate_address(%s, %p)", mname, regs_addr); goto err; } @@ -369,7 +367,7 @@ fman_if_init(const struct device_node *dpa_node) PROT_READ | PROT_WRITE, MAP_SHARED, fman_ccsr_map_fd, phys_addr); if (__if->ccsr_map == MAP_FAILED) { - FMAN_ERR(-errno, "mmap(0x%"PRIx64")\n", phys_addr); + FMAN_ERR(-errno, "mmap(0x%"PRIx64")", phys_addr); goto err; } na = of_n_addr_cells(mac_node); @@ -380,13 +378,13 @@ fman_if_init(const struct device_node *dpa_node) fman_node = of_get_parent(mac_node); na = of_n_addr_cells(mac_node); if (!fman_node) { - FMAN_ERR(-ENXIO, "of_get_parent(%s)\n", mname); + FMAN_ERR(-ENXIO, "of_get_parent(%s)", mname); goto err; } fname = fman_node->full_name; cell_idx = of_get_property(fman_node, "cell-index", &lenp); if (!cell_idx) { - FMAN_ERR(-ENXIO, "%s: no cell-index)\n", fname); + FMAN_ERR(-ENXIO, "%s: no cell-index)", fname); goto err; } assert(lenp == sizeof(*cell_idx)); @@ -395,7 +393,7 @@ fman_if_init(const struct device_node *dpa_node) if (!get_once) { _errno = fman_get_ip_rev(fman_node); if (_errno) { - FMAN_ERR(-ENXIO, "%s: ip_rev is not available\n", + FMAN_ERR(-ENXIO, "%s: ip_rev is not available", fname); goto err; } @@ -425,7 +423,7 @@ fman_if_init(const struct device_node *dpa_node) char_prop = of_get_property(mac_node, "phy-connection-type", NULL); if (!char_prop) { - printf("memac: unknown MII type assuming 1G\n"); + FMAN_ERR(-EINVAL, "memac: unknown MII type assuming 1G"); /* Right now forcing memac to 1g in case of error*/ __if->__if.mac_type = fman_mac_1g; } else { @@ -440,7 +438,7 @@ fman_if_init(const struct device_node *dpa_node) __if->__if.mac_type = fman_mac_10g; } } else { - FMAN_ERR(-EINVAL, "%s: unknown MAC type\n", mname); + FMAN_ERR(-EINVAL, "%s: unknown MAC type", mname); goto err; } @@ -463,7 +461,7 @@ fman_if_init(const struct device_node *dpa_node) mac_addr = of_get_property(mac_node, "local-mac-address", &lenp); if (!mac_addr) { - FMAN_ERR(-EINVAL, "%s: no local-mac-address\n", + FMAN_ERR(-EINVAL, "%s: no local-mac-address", mname); goto err; } @@ -473,19 +471,19 @@ fman_if_init(const struct device_node *dpa_node) tx_channel_id = of_get_property(tx_node, "fsl,qman-channel-id", &lenp); if (!tx_channel_id) { - FMAN_ERR(-EINVAL, "%s: no fsl-qman-channel-id\n", + FMAN_ERR(-EINVAL, "%s: no fsl-qman-channel-id", tx_node->full_name); goto err; } regs_addr = of_get_address(rx_node, 0, &__if->regs_size, NULL); if (!regs_addr) { - FMAN_ERR(-EINVAL, "of_get_address(%s)\n", mname); + FMAN_ERR(-EINVAL, "of_get_address(%s)", mname); goto err; } phys_addr = of_translate_address(rx_node, regs_addr); if (!phys_addr) { - FMAN_ERR(-EINVAL, "of_translate_address(%s, %p)\n", + FMAN_ERR(-EINVAL, "of_translate_address(%s, %p)", mname, regs_addr); goto err; } @@ -493,7 +491,7 @@ fman_if_init(const struct device_node *dpa_node) PROT_READ | PROT_WRITE, MAP_SHARED, fman_ccsr_map_fd, phys_addr); if (__if->bmi_map == MAP_FAILED) { - FMAN_ERR(-errno, "mmap(0x%"PRIx64")\n", phys_addr); + FMAN_ERR(-errno, "mmap(0x%"PRIx64")", phys_addr); goto err; } @@ -507,7 +505,7 @@ fman_if_init(const struct device_node *dpa_node) */ rx_phandle = of_get_property(dpa_node, rprop, &lenp); if (!rx_phandle) { - FMAN_ERR(-EINVAL, "%s: no fsl,qman-frame-queues-rx\n", dname); + FMAN_ERR(-EINVAL, "%s: no fsl,qman-frame-queues-rx", dname); goto err; } @@ -542,7 +540,7 @@ fman_if_init(const struct device_node *dpa_node) tx_phandle = of_get_property(dpa_node, "fsl,qman-frame-queues-tx", &lenp); if (!tx_phandle) { - FMAN_ERR(-EINVAL, "%s: no fsl,qman-frame-queues-tx\n", dname); + FMAN_ERR(-EINVAL, "%s: no fsl,qman-frame-queues-tx", dname); goto err; } @@ -562,7 +560,7 @@ fman_if_init(const struct device_node *dpa_node) pools_phandle = of_get_property(dpa_node, "fsl,bman-buffer-pools", &lenp); if (!pools_phandle) { - FMAN_ERR(-EINVAL, "%s: no fsl,bman-buffer-pools\n", dname); + FMAN_ERR(-EINVAL, "%s: no fsl,bman-buffer-pools", dname); goto err; } /* For each pool, parse the corresponding node and add a pool object @@ -578,13 +576,13 @@ fman_if_init(const struct device_node *dpa_node) /* Allocate an object for the pool */ bpool = rte_malloc(NULL, sizeof(*bpool), RTE_CACHE_LINE_SIZE); if (!bpool) { - FMAN_ERR(-ENOMEM, "malloc(%zu)\n", sizeof(*bpool)); + FMAN_ERR(-ENOMEM, "malloc(%zu)", sizeof(*bpool)); goto err; } /* Find the pool node */ pool_node = of_find_node_by_phandle(*pools_phandle); if (!pool_node) { - FMAN_ERR(-ENXIO, "%s: bad fsl,bman-buffer-pools\n", + FMAN_ERR(-ENXIO, "%s: bad fsl,bman-buffer-pools", dname); rte_free(bpool); goto err; @@ -593,7 +591,7 @@ fman_if_init(const struct device_node *dpa_node) /* Extract the BPID property */ prop = of_get_property(pool_node, "fsl,bpid", &proplen); if (!prop) { - FMAN_ERR(-EINVAL, "%s: no fsl,bpid\n", pname); + FMAN_ERR(-EINVAL, "%s: no fsl,bpid", pname); rte_free(bpool); goto err; } @@ -691,7 +689,7 @@ fman_init(void) for_each_child_node(parent_node, dpa_node) { _errno = fman_if_init(dpa_node); if (_errno) { - FMAN_ERR(_errno, "if_init(%s)\n", dpa_node->full_name); + FMAN_ERR(_errno, "if_init(%s)", dpa_node->full_name); goto err; } } diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c index 5d4352bb3c..e483428ddc 100644 --- a/drivers/bus/dpaa/dpaa_bus.c +++ b/drivers/bus/dpaa/dpaa_bus.c @@ -326,7 +326,7 @@ int rte_dpaa_portal_init(void *arg) dpaa_seqn_dynfield_offset = rte_mbuf_dynfield_register(&dpaa_seqn_dynfield_desc); if (dpaa_seqn_dynfield_offset < 0) { - DPAA_BUS_LOG(ERR, "Failed to register mbuf field for dpaa sequence number\n"); + DPAA_BUS_LOG(ERR, "Failed to register mbuf field for dpaa sequence number"); return -rte_errno; } @@ -673,7 +673,7 @@ rte_dpaa_bus_probe(void) if (dev->device_type == FSL_DPAA_ETH) { ret = rte_dpaa_setup_intr(dev->intr_handle); if (ret) - DPAA_BUS_ERR("Error setting up interrupt.\n"); + DPAA_BUS_ERR("Error setting up interrupt."); } } @@ -734,13 +734,13 @@ rte_dpaa_find_device(const struct rte_device *start, rte_dev_cmp_t cmp, while (dev != NULL) { if (cmp(&dev->device, data) == 0) { - DPAA_BUS_DEBUG("Found dev=(%s)\n", dev->device.name); + DPAA_BUS_DEBUG("Found dev=(%s)", dev->device.name); return &dev->device; } dev = TAILQ_NEXT(dev, next); } - DPAA_BUS_DEBUG("Unable to find any device\n"); + DPAA_BUS_DEBUG("Unable to find any device"); return NULL; } @@ -786,14 +786,14 @@ dpaa_bus_dev_iterate(const void *start, const char *str, /* Expectation is that device would be name=device_name */ if (strncmp(str, "name=", 5) != 0) { - DPAA_BUS_DEBUG("Invalid device string (%s)\n", str); + DPAA_BUS_DEBUG("Invalid device string (%s)", str); return NULL; } /* Now that name=device_name format is available, split */ dup = strdup(str); if (dup == NULL) { - DPAA_BUS_DEBUG("Dup string (%s) failed!\n", str); + DPAA_BUS_DEBUG("Dup string (%s) failed!", str); return NULL; } dev_name = dup + strlen("name="); diff --git a/drivers/event/dpaa/dpaa_eventdev.c b/drivers/event/dpaa/dpaa_eventdev.c index 919e922298..f8cf48bd2e 100644 --- a/drivers/event/dpaa/dpaa_eventdev.c +++ b/drivers/event/dpaa/dpaa_eventdev.c @@ -386,13 +386,13 @@ dpaa_event_dev_configure(const struct rte_eventdev *dev) sizeof(uint32_t) * priv->nb_event_queues, RTE_CACHE_LINE_SIZE); if (ch_id == NULL) { - DPAA_EVENTDEV_ERR("Fail to allocate memory for dpaa channels\n"); + DPAA_EVENTDEV_ERR("Fail to allocate memory for dpaa channels"); return -ENOMEM; } /* Create requested event queues within the given event device */ ret = qman_alloc_pool_range(ch_id, priv->nb_event_queues, 1, 0); if (ret < 0) { - DPAA_EVENTDEV_ERR("qman_alloc_pool_range %u, err =%d\n", + DPAA_EVENTDEV_ERR("qman_alloc_pool_range %u, err =%d", priv->nb_event_queues, ret); rte_free(ch_id); return ret; @@ -655,7 +655,7 @@ dpaa_event_eth_rx_adapter_queue_add( queue_conf); if (ret) { DPAA_EVENTDEV_ERR( - "Event Queue attach failed:%d\n", ret); + "Event Queue attach failed:%d", ret); goto detach_configured_queues; } } @@ -664,7 +664,7 @@ dpaa_event_eth_rx_adapter_queue_add( ret = dpaa_eth_eventq_attach(eth_dev, rx_queue_id, ch_id, queue_conf); if (ret) - DPAA_EVENTDEV_ERR("dpaa_eth_eventq_attach failed:%d\n", ret); + DPAA_EVENTDEV_ERR("dpaa_eth_eventq_attach failed:%d", ret); return ret; detach_configured_queues: @@ -691,7 +691,7 @@ dpaa_event_eth_rx_adapter_queue_del(const struct rte_eventdev *dev, ret = dpaa_eth_eventq_detach(eth_dev, i); if (ret) DPAA_EVENTDEV_ERR( - "Event Queue detach failed:%d\n", ret); + "Event Queue detach failed:%d", ret); } return 0; @@ -699,7 +699,7 @@ dpaa_event_eth_rx_adapter_queue_del(const struct rte_eventdev *dev, ret = dpaa_eth_eventq_detach(eth_dev, rx_queue_id); if (ret) - DPAA_EVENTDEV_ERR("dpaa_eth_eventq_detach failed:%d\n", ret); + DPAA_EVENTDEV_ERR("dpaa_eth_eventq_detach failed:%d", ret); return ret; } @@ -762,7 +762,7 @@ dpaa_eventdev_crypto_queue_add_all(const struct rte_eventdev *dev, ret = dpaa_sec_eventq_attach(cryptodev, i, ch_id, ev); if (ret) { - DPAA_EVENTDEV_ERR("dpaa_sec_eventq_attach failed: ret %d\n", + DPAA_EVENTDEV_ERR("dpaa_sec_eventq_attach failed: ret %d", ret); goto fail; } @@ -796,7 +796,7 @@ dpaa_eventdev_crypto_queue_add(const struct rte_eventdev *dev, ch_id, &conf->ev); if (ret) { DPAA_EVENTDEV_ERR( - "dpaa_sec_eventq_attach failed: ret: %d\n", ret); + "dpaa_sec_eventq_attach failed: ret: %d", ret); return ret; } return 0; @@ -816,7 +816,7 @@ dpaa_eventdev_crypto_queue_del_all(const struct rte_eventdev *dev, ret = dpaa_sec_eventq_detach(cdev, i); if (ret) { DPAA_EVENTDEV_ERR( - "dpaa_sec_eventq_detach failed:ret %d\n", ret); + "dpaa_sec_eventq_detach failed:ret %d", ret); return ret; } } @@ -839,7 +839,7 @@ dpaa_eventdev_crypto_queue_del(const struct rte_eventdev *dev, ret = dpaa_sec_eventq_detach(cryptodev, rx_queue_id); if (ret) { DPAA_EVENTDEV_ERR( - "dpaa_sec_eventq_detach failed: ret: %d\n", ret); + "dpaa_sec_eventq_detach failed: ret: %d", ret); return ret; } diff --git a/drivers/mempool/dpaa/dpaa_mempool.c b/drivers/mempool/dpaa/dpaa_mempool.c index 0b484b3d9c..21e8938cc6 100644 --- a/drivers/mempool/dpaa/dpaa_mempool.c +++ b/drivers/mempool/dpaa/dpaa_mempool.c @@ -285,7 +285,7 @@ dpaa_mbuf_get_count(const struct rte_mempool *mp) MEMPOOL_INIT_FUNC_TRACE(); if (!mp || !mp->pool_data) { - DPAA_MEMPOOL_ERR("Invalid mempool provided\n"); + DPAA_MEMPOOL_ERR("Invalid mempool provided"); return 0; } @@ -303,7 +303,7 @@ dpaa_populate(struct rte_mempool *mp, unsigned int max_objs, unsigned int total_elt_sz; if (!mp || !mp->pool_data) { - DPAA_MEMPOOL_ERR("Invalid mempool provided\n"); + DPAA_MEMPOOL_ERR("Invalid mempool provided"); return 0; } diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 093f9a8ff9..44bac67803 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -261,7 +261,7 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev) if (dpaa_fm_config(dev, eth_conf->rx_adv_conf.rss_conf.rss_hf)) { dpaa_write_fm_config_to_file(); - DPAA_PMD_ERR("FM port configuration: Failed\n"); + DPAA_PMD_ERR("FM port configuration: Failed"); return -1; } dpaa_write_fm_config_to_file(); @@ -393,7 +393,7 @@ static void dpaa_interrupt_handler(void *param) bytes_read = read(rte_intr_fd_get(intr_handle), &buf, sizeof(uint64_t)); if (bytes_read < 0) - DPAA_PMD_ERR("Error reading eventfd\n"); + DPAA_PMD_ERR("Error reading eventfd"); dpaa_eth_link_update(dev, 0); rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL); } @@ -469,7 +469,7 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev) /* DPAA FM deconfig */ if (!(default_q || fmc_q)) { if (dpaa_fm_deconfig(dpaa_intf, dev->process_private)) - DPAA_PMD_WARN("DPAA FM deconfig failed\n"); + DPAA_PMD_WARN("DPAA FM deconfig failed"); } dpaa_dev = container_of(rdev, struct rte_dpaa_device, device); @@ -721,7 +721,7 @@ static int dpaa_eth_link_update(struct rte_eth_dev *dev, dpaa_intf->name, fif->mac_type); } - DPAA_PMD_INFO("Port %d Link is %s\n", dev->data->port_id, + DPAA_PMD_INFO("Port %d Link is %s", dev->data->port_id, link->link_status ? "Up" : "Down"); return 0; } @@ -1027,7 +1027,7 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, } } else { DPAA_PMD_INFO("Base profile is associated to" - " RXQ fqid:%d\r\n", rxq->fqid); + " RXQ fqid:%d", rxq->fqid); if (fif->is_shared_mac) { DPAA_PMD_ERR("Fatal: Base profile is associated" " to shared interface on DPDK."); @@ -1174,7 +1174,7 @@ dpaa_eth_eventq_attach(const struct rte_eth_dev *dev, if (dpaa_push_mode_max_queue) DPAA_PMD_WARN("PUSH mode q and EVENTDEV are not compatible\n" "PUSH mode already enabled for first %d queues.\n" - "To disable set DPAA_PUSH_QUEUES_NUMBER to 0\n", + "To disable set DPAA_PUSH_QUEUES_NUMBER to 0", dpaa_push_mode_max_queue); dpaa_poll_queue_default_config(&opts); @@ -1189,7 +1189,7 @@ dpaa_eth_eventq_attach(const struct rte_eth_dev *dev, rxq->cb.dqrr_dpdk_cb = dpaa_rx_cb_atomic; break; case RTE_SCHED_TYPE_ORDERED: - DPAA_PMD_ERR("Ordered queue schedule type is not supported\n"); + DPAA_PMD_ERR("Ordered queue schedule type is not supported"); return -1; default: opts.fqd.fq_ctrl |= QM_FQCTRL_AVOIDBLOCK; @@ -1461,12 +1461,12 @@ dpaa_dev_rss_hash_update(struct rte_eth_dev *dev, if (!(default_q || fmc_q)) { if (dpaa_fm_config(dev, rss_conf->rss_hf)) { - DPAA_PMD_ERR("FM port configuration: Failed\n"); + DPAA_PMD_ERR("FM port configuration: Failed"); return -1; } eth_conf->rx_adv_conf.rss_conf.rss_hf = rss_conf->rss_hf; } else { - DPAA_PMD_ERR("Function not supported\n"); + DPAA_PMD_ERR("Function not supported"); return -ENOTSUP; } return 0; @@ -1786,7 +1786,7 @@ static int dpaa_tx_queue_init(struct qman_fq *fq, opts.we_mask |= QM_INITFQ_WE_CGID; opts.fqd.cgid = cgr_tx->cgrid; opts.fqd.fq_ctrl |= QM_FQCTRL_CGE; - DPAA_PMD_DEBUG("Tx FQ tail drop enabled, threshold = %d\n", + DPAA_PMD_DEBUG("Tx FQ tail drop enabled, threshold = %d", td_tx_threshold); } without_cgr: @@ -1925,7 +1925,7 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) * queues. */ if (num_rx_fqs < 0 || num_rx_fqs > DPAA_MAX_NUM_PCD_QUEUES) { - DPAA_PMD_ERR("Invalid number of RX queues\n"); + DPAA_PMD_ERR("Invalid number of RX queues"); return -EINVAL; } @@ -1933,7 +1933,7 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) dpaa_intf->rx_queues = rte_zmalloc(NULL, sizeof(struct qman_fq) * num_rx_fqs, MAX_CACHELINE); if (!dpaa_intf->rx_queues) { - DPAA_PMD_ERR("Failed to alloc mem for RX queues\n"); + DPAA_PMD_ERR("Failed to alloc mem for RX queues"); return -ENOMEM; } } else { @@ -1960,7 +1960,7 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) dpaa_intf->cgr_rx = rte_zmalloc(NULL, sizeof(struct qman_cgr) * num_rx_fqs, MAX_CACHELINE); if (!dpaa_intf->cgr_rx) { - DPAA_PMD_ERR("Failed to alloc mem for cgr_rx\n"); + DPAA_PMD_ERR("Failed to alloc mem for cgr_rx"); ret = -ENOMEM; goto free_rx; } @@ -1979,7 +1979,7 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) ret = qman_alloc_fqid_range(dev_rx_fqids, num_rx_fqs, num_rx_fqs, 0); if (ret < 0) { - DPAA_PMD_ERR("Failed to alloc rx fqid's\n"); + DPAA_PMD_ERR("Failed to alloc rx fqid's"); goto free_rx; } } @@ -2009,7 +2009,7 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) dpaa_intf->tx_queues = rte_zmalloc(NULL, sizeof(struct qman_fq) * MAX_DPAA_CORES, MAX_CACHELINE); if (!dpaa_intf->tx_queues) { - DPAA_PMD_ERR("Failed to alloc mem for TX queues\n"); + DPAA_PMD_ERR("Failed to alloc mem for TX queues"); ret = -ENOMEM; goto free_rx; } @@ -2020,7 +2020,7 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) sizeof(struct qman_cgr) * MAX_DPAA_CORES, MAX_CACHELINE); if (!dpaa_intf->cgr_tx) { - DPAA_PMD_ERR("Failed to alloc mem for cgr_tx\n"); + DPAA_PMD_ERR("Failed to alloc mem for cgr_tx"); ret = -ENOMEM; goto free_rx; } @@ -2184,7 +2184,7 @@ rte_dpaa_probe(struct rte_dpaa_driver *dpaa_drv, if (!(default_q || fmc_q)) { if (dpaa_fm_init()) { - DPAA_PMD_ERR("FM init failed\n"); + DPAA_PMD_ERR("FM init failed"); return -1; } } @@ -2247,7 +2247,7 @@ rte_dpaa_probe(struct rte_dpaa_driver *dpaa_drv, DPAA_MAX_SGS * sizeof(struct qm_sg_entry), rte_socket_id()); if (dpaa_tx_sg_pool == NULL) { - DPAA_PMD_ERR("SG pool creation failed\n"); + DPAA_PMD_ERR("SG pool creation failed"); return -ENOMEM; } } @@ -2297,17 +2297,17 @@ static void __attribute__((destructor(102))) dpaa_finish(void) if (dpaa_intf->port_handle) if (dpaa_fm_deconfig(dpaa_intf, fif)) DPAA_PMD_WARN("DPAA FM " - "deconfig failed\n"); + "deconfig failed"); if (fif->num_profiles) { if (dpaa_port_vsp_cleanup(dpaa_intf, fif)) - DPAA_PMD_WARN("DPAA FM vsp cleanup failed\n"); + DPAA_PMD_WARN("DPAA FM vsp cleanup failed"); } } } if (is_global_init) if (dpaa_fm_term()) - DPAA_PMD_WARN("DPAA FM term failed\n"); + DPAA_PMD_WARN("DPAA FM term failed"); is_global_init = 0; diff --git a/drivers/net/dpaa/dpaa_flow.c b/drivers/net/dpaa/dpaa_flow.c index b78477a59a..02aca78d05 100644 --- a/drivers/net/dpaa/dpaa_flow.c +++ b/drivers/net/dpaa/dpaa_flow.c @@ -531,7 +531,7 @@ static inline int set_port_pcd(struct dpaa_if *dpaa_intf) /* FM PORT DeletePCD */ ret = fm_port_delete_pcd(dpaa_intf->port_handle); if (ret != E_OK) { - DPAA_PMD_ERR("fm_port_delete_pcd: Failed\n"); + DPAA_PMD_ERR("fm_port_delete_pcd: Failed"); return ret; } return -1; @@ -686,7 +686,7 @@ static inline int set_fm_port_handle(struct dpaa_if *dpaa_intf, /* FM PORT Open */ dpaa_intf->port_handle = fm_port_open(&fm_port_params); if (!dpaa_intf->port_handle) { - DPAA_PMD_ERR("fm_port_open: Failed\n"); + DPAA_PMD_ERR("fm_port_open: Failed"); return -1; } diff --git a/drivers/net/dpaa/fmlib/fm_lib.c b/drivers/net/dpaa/fmlib/fm_lib.c index 1d6816050c..68b519ff8a 100644 --- a/drivers/net/dpaa/fmlib/fm_lib.c +++ b/drivers/net/dpaa/fmlib/fm_lib.c @@ -102,7 +102,7 @@ fm_get_api_version(t_handle h_fm, ioc_fm_api_version_t *p_version) ret = ioctl(p_dev->fd, FM_IOC_GET_API_VERSION, p_version); if (ret) { - DPAA_PMD_ERR("cannot get API version, error %i (%s)\n", + DPAA_PMD_ERR("cannot get API version, error %i (%s)", errno, strerror(errno)); RETURN_ERROR(MINOR, E_INVALID_OPERATION, NO_MSG); } @@ -275,7 +275,7 @@ fm_pcd_kg_scheme_set(t_handle h_fm_pcd, ret = ioctl(p_pcd_dev->fd, FM_PCD_IOC_KG_SCHEME_SET, params); if (ret) { - DPAA_PMD_ERR(" cannot set kg scheme, error %i (%s)\n", + DPAA_PMD_ERR(" cannot set kg scheme, error %i (%s)", errno, strerror(errno)); return NULL; } @@ -309,7 +309,7 @@ fm_pcd_kg_scheme_delete(t_handle h_scheme) id.obj = UINT_TO_PTR(p_dev->id); if (ioctl(p_pcd_dev->fd, FM_PCD_IOC_KG_SCHEME_DELETE, &id)) { - DPAA_PMD_WARN("cannot delete kg scheme, error %i (%s)\n", + DPAA_PMD_WARN("cannot delete kg scheme, error %i (%s)", errno, strerror(errno)); RETURN_ERROR(MINOR, E_INVALID_OPERATION, NO_MSG); } diff --git a/drivers/net/dpaa/fmlib/fm_vsp.c b/drivers/net/dpaa/fmlib/fm_vsp.c index 78efd93f22..a5901c8f6e 100644 --- a/drivers/net/dpaa/fmlib/fm_vsp.c +++ b/drivers/net/dpaa/fmlib/fm_vsp.c @@ -55,13 +55,13 @@ fm_vsp_config(t_fm_vsp_params *p_fm_vsp_params) param.id = NULL; if (ioctl(p_dev->fd, FM_IOC_VSP_CONFIG, ¶m)) { - DPAA_PMD_ERR("%s ioctl error\n", __func__); + DPAA_PMD_ERR("ioctl error"); return NULL; } p_vsp_dev = (t_device *)malloc(sizeof(t_device)); if (!p_vsp_dev) { - DPAA_PMD_ERR("FM VSP Params!\n"); + DPAA_PMD_ERR("FM VSP Params!"); return NULL; } memset(p_vsp_dev, 0, sizeof(t_device)); @@ -87,7 +87,7 @@ fm_vsp_init(t_handle h_fm_vsp) id.obj = UINT_TO_PTR(p_vsp_dev->id); if (ioctl(p_dev->fd, FM_IOC_VSP_INIT, &id)) { - DPAA_PMD_ERR("%s ioctl error\n", __func__); + DPAA_PMD_ERR("ioctl error"); RETURN_ERROR(MINOR, E_INVALID_OPERATION, NO_MSG); } @@ -109,7 +109,7 @@ fm_vsp_free(t_handle h_fm_vsp) id.obj = UINT_TO_PTR(p_vsp_dev->id); if (ioctl(p_dev->fd, FM_IOC_VSP_FREE, &id)) { - DPAA_PMD_ERR("%s ioctl error\n", __func__); + DPAA_PMD_ERR("ioctl error"); RETURN_ERROR(MINOR, E_INVALID_OPERATION, NO_MSG); } @@ -138,7 +138,7 @@ fm_vsp_config_buffer_prefix_content(t_handle h_fm_vsp, if (ioctl(p_dev->fd, FM_IOC_VSP_CONFIG_BUFFER_PREFIX_CONTENT, ¶ms)) { - DPAA_PMD_ERR("%s ioctl error\n", __func__); + DPAA_PMD_ERR("ioctl error"); RETURN_ERROR(MINOR, E_INVALID_OPERATION, NO_MSG); } -- 2.25.1 ^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v4 3/3] drivers: replace printf with fprintf for debug functions 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 ` Hemant Agrawal 2024-07-03 14:54 ` [PATCH v4 1/3] drivers: replace printf with log macros David Marchand 2 siblings, 0 replies; 22+ messages in thread From: Hemant Agrawal @ 2024-07-03 12:16 UTC (permalink / raw) To: dev, thomas, stephen, david.marchand This patch replaces simple printf with fprintf for debug dump related functions for various NXP dpaaX related drivers. Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com> --- drivers/bus/dpaa/base/fman/netcfg_layer.c | 22 +++---- drivers/bus/dpaa/dpaa_bus.c | 2 +- drivers/bus/dpaa/include/netcfg.h | 2 +- drivers/crypto/caam_jr/caam_jr.c | 4 +- drivers/crypto/caam_jr/caam_jr_desc.h | 4 +- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 32 +++++----- drivers/crypto/dpaa_sec/dpaa_sec.c | 62 +++++++++---------- drivers/net/dpaa2/dpaa2_flow.c | 66 +++++++++++---------- 8 files changed, 98 insertions(+), 96 deletions(-) diff --git a/drivers/bus/dpaa/base/fman/netcfg_layer.c b/drivers/bus/dpaa/base/fman/netcfg_layer.c index 6a405c984d..57d87afcb0 100644 --- a/drivers/bus/dpaa/base/fman/netcfg_layer.c +++ b/drivers/bus/dpaa/base/fman/netcfg_layer.c @@ -29,37 +29,37 @@ static int skfd = -1; #ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER void -dump_netcfg(struct netcfg_info *cfg_ptr) +dump_netcfg(struct netcfg_info *cfg_ptr, FILE *f) { int i; - printf(".......... DPAA Configuration ..........\n\n"); + fprintf(f, ".......... DPAA Configuration ..........\n\n"); /* Network interfaces */ - printf("Network interfaces: %d\n", cfg_ptr->num_ethports); + fprintf(f, "Network interfaces: %d\n", cfg_ptr->num_ethports); for (i = 0; i < cfg_ptr->num_ethports; i++) { struct fman_if_bpool *bpool; struct fm_eth_port_cfg *p_cfg = &cfg_ptr->port_cfg[i]; struct fman_if *__if = p_cfg->fman_if; - printf("\n+ Fman %d, MAC %d (%s);\n", + fprintf(f, "\n+ Fman %d, MAC %d (%s);\n", __if->fman_idx, __if->mac_idx, (__if->mac_type == fman_mac_1g) ? "1G" : (__if->mac_type == fman_mac_2_5g) ? "2.5G" : "10G"); - printf("\tmac_addr: " RTE_ETHER_ADDR_PRT_FMT "\n", + fprintf(f, "\tmac_addr: " RTE_ETHER_ADDR_PRT_FMT "\n", RTE_ETHER_ADDR_BYTES(&__if->mac_addr)); - printf("\ttx_channel_id: 0x%02x\n", + fprintf(f, "\ttx_channel_id: 0x%02x\n", __if->tx_channel_id); - printf("\tfqid_rx_def: 0x%x\n", p_cfg->rx_def); - printf("\tfqid_rx_err: 0x%x\n", __if->fqid_rx_err); + fprintf(f, "\tfqid_rx_def: 0x%x\n", p_cfg->rx_def); + fprintf(f, "\tfqid_rx_err: 0x%x\n", __if->fqid_rx_err); - printf("\tfqid_tx_err: 0x%x\n", __if->fqid_tx_err); - printf("\tfqid_tx_confirm: 0x%x\n", __if->fqid_tx_confirm); + fprintf(f, "\tfqid_tx_err: 0x%x\n", __if->fqid_tx_err); + fprintf(f, "\tfqid_tx_confirm: 0x%x\n", __if->fqid_tx_confirm); fman_if_for_each_bpool(bpool, __if) - printf("\tbuffer pool: (bpid=%d, count=%"PRId64 + fprintf(f, "\tbuffer pool: (bpid=%d, count=%"PRId64 " size=%"PRId64", addr=0x%"PRIx64")\n", bpool->bpid, bpool->count, bpool->size, bpool->addr); diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c index e483428ddc..8ce93abd84 100644 --- a/drivers/bus/dpaa/dpaa_bus.c +++ b/drivers/bus/dpaa/dpaa_bus.c @@ -586,7 +586,7 @@ rte_dpaa_bus_dev_build(void) } #ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER - dump_netcfg(dpaa_netcfg); + dump_netcfg(dpaa_netcfg, stdout); #endif DPAA_BUS_LOG(DEBUG, "Number of ethernet devices = %d", diff --git a/drivers/bus/dpaa/include/netcfg.h b/drivers/bus/dpaa/include/netcfg.h index 5bdcc9186a..ebbbaf6d10 100644 --- a/drivers/bus/dpaa/include/netcfg.h +++ b/drivers/bus/dpaa/include/netcfg.h @@ -60,7 +60,7 @@ void netcfg_release(struct netcfg_info *cfg_ptr); /* cfg_ptr: configuration information pointer. * This function dumps configuration data to stdout. */ -void dump_netcfg(struct netcfg_info *cfg_ptr); +void dump_netcfg(struct netcfg_info *cfg_ptr, FILE *f); #endif #endif /* __NETCFG_H */ diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c index dd59fe8384..6ed7a8f41c 100644 --- a/drivers/crypto/caam_jr/caam_jr.c +++ b/drivers/crypto/caam_jr/caam_jr.c @@ -1410,9 +1410,9 @@ caam_jr_enqueue_op(struct rte_crypto_op *op, struct caam_jr_qp *qp) rte_pktmbuf_mtod(op->sym->m_src, void *), rte_pktmbuf_data_len(op->sym->m_src)); - printf("\n JD before conversion\n"); + fprintf(stdout, "\n JD before conversion\n"); for (i = 0; i < 12; i++) - printf("\n 0x%08x", ctx->jobdes.desc[i]); + fprintf(stdout, "\n 0x%08x", ctx->jobdes.desc[i]); #endif CAAM_JR_DP_DEBUG("Jr[%p] pi[%d] ci[%d].Before sending desc", diff --git a/drivers/crypto/caam_jr/caam_jr_desc.h b/drivers/crypto/caam_jr/caam_jr_desc.h index c85278bf1e..a4507613be 100644 --- a/drivers/crypto/caam_jr/caam_jr_desc.h +++ b/drivers/crypto/caam_jr/caam_jr_desc.h @@ -110,13 +110,13 @@ ((struct descriptor_header_s *)(descriptor))->command.jd.desclen) /* Helper macro for dumping the hex representation of a descriptor */ -#define SEC_DUMP_DESC(descriptor) { \ +#define SEC_DUMP_DESC(descriptor, f) { \ int __i; \ CAAM_JR_INFO("Des@ 0x%08x\n", (uint32_t)((uint32_t *)(descriptor)));\ for (__i = 0; \ __i < SEC_GET_DESC_LEN(descriptor); \ __i++) { \ - printf("0x%08x: 0x%08x\n", \ + fprintf(f, "0x%08x: 0x%08x\n", \ (uint32_t)(((uint32_t *)(descriptor)) + __i), \ *(((uint32_t *)(descriptor)) + __i)); \ } \ diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c index 1cae6c4505..4c5b98d9be 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -1621,7 +1621,7 @@ sec_fd_to_mbuf(const struct qbman_fd *fd, struct dpaa2_sec_qp *qp) } static void -dpaa2_sec_dump(struct rte_crypto_op *op) +dpaa2_sec_dump(struct rte_crypto_op *op, FILE *f) { int i; dpaa2_sec_session *sess = NULL; @@ -1640,18 +1640,18 @@ dpaa2_sec_dump(struct rte_crypto_op *op) goto mbuf_dump; priv = (struct ctxt_priv *)sess->ctxt; - printf("\n****************************************\n" + fprintf(f, "\n****************************************\n" "session params:\n\tContext type:\t%d\n\tDirection:\t%s\n" "\tCipher alg:\t%d\n\tAuth alg:\t%d\n\tAead alg:\t%d\n" "\tCipher key len:\t%zd\n", sess->ctxt_type, (sess->dir == DIR_ENC) ? "DIR_ENC" : "DIR_DEC", sess->cipher_alg, sess->auth_alg, sess->aead_alg, sess->cipher_key.length); - rte_hexdump(stdout, "cipher key", sess->cipher_key.data, + rte_hexdump(f, "cipher key", sess->cipher_key.data, sess->cipher_key.length); - rte_hexdump(stdout, "auth key", sess->auth_key.data, + rte_hexdump(f, "auth key", sess->auth_key.data, sess->auth_key.length); - printf("\tAuth key len:\t%zd\n\tIV len:\t\t%d\n\tIV offset:\t%d\n" + fprintf(f, "\tAuth key len:\t%zd\n\tIV len:\t\t%d\n\tIV offset:\t%d\n" "\tdigest length:\t%d\n\tstatus:\t\t%d\n\taead auth only" " len:\t%d\n\taead cipher text:\t%d\n", sess->auth_key.length, sess->iv.length, sess->iv.offset, @@ -1659,7 +1659,7 @@ dpaa2_sec_dump(struct rte_crypto_op *op) sess->ext_params.aead_ctxt.auth_only_len, sess->ext_params.aead_ctxt.auth_cipher_text); #ifdef RTE_LIB_SECURITY - printf("PDCP session params:\n" + fprintf(f, "PDCP session params:\n" "\tDomain:\t\t%d\n\tBearer:\t\t%d\n\tpkt_dir:\t%d\n\thfn_ovd:" "\t%d\n\tsn_size:\t%d\n\thfn_ovd_offset:\t%d\n\thfn:\t\t%d\n" "\thfn_threshold:\t0x%x\n", sess->pdcp.domain, @@ -1669,29 +1669,29 @@ dpaa2_sec_dump(struct rte_crypto_op *op) #endif bufsize = (uint8_t)priv->flc_desc[0].flc.word1_sdl; - printf("Descriptor Dump:\n"); + fprintf(f, "Descriptor Dump:\n"); for (i = 0; i < bufsize; i++) - printf("\tDESC[%d]:0x%x\n", i, priv->flc_desc[0].desc[i]); + fprintf(f, "\tDESC[%d]:0x%x\n", i, priv->flc_desc[0].desc[i]); - printf("\n"); + fprintf(f, "\n"); mbuf_dump: sym_op = op->sym; if (sym_op->m_src) { - printf("Source mbuf:\n"); - rte_pktmbuf_dump(stdout, sym_op->m_src, sym_op->m_src->data_len); + fprintf(f, "Source mbuf:\n"); + rte_pktmbuf_dump(f, sym_op->m_src, sym_op->m_src->data_len); } if (sym_op->m_dst) { - printf("Destination mbuf:\n"); - rte_pktmbuf_dump(stdout, sym_op->m_dst, sym_op->m_dst->data_len); + fprintf(f, "Destination mbuf:\n"); + rte_pktmbuf_dump(f, sym_op->m_dst, sym_op->m_dst->data_len); } - printf("Session address = %p\ncipher offset: %d, length: %d\n" + fprintf(f, "Session address = %p\ncipher offset: %d, length: %d\n" "auth offset: %d, length: %d\n aead offset: %d, length: %d\n" , sym_op->session, sym_op->cipher.data.offset, sym_op->cipher.data.length, sym_op->auth.data.offset, sym_op->auth.data.length, sym_op->aead.data.offset, sym_op->aead.data.length); - printf("\n"); + fprintf(f, "\n"); } @@ -1951,7 +1951,7 @@ dpaa2_sec_dequeue_burst(void *qp, struct rte_crypto_op **ops, DPAA2_SEC_DP_ERR("SEC returned Error - %x\n", fd->simple.frc); if (dpaa2_sec_dp_dump > DPAA2_SEC_DP_ERR_DUMP) - dpaa2_sec_dump(ops[num_rx]); + dpaa2_sec_dump(ops[num_rx], stdout); } dpaa2_qp->rx_vq.err_pkts += 1; diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c index 44528eaf7f..7aa163330a 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.c +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c @@ -654,7 +654,7 @@ dpaa_sec_prep_cdb(dpaa_sec_session *ses) } static void -dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp) +dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp, FILE *f) { struct dpaa_sec_job *job = &ctx->job; struct rte_crypto_op *op = ctx->op; @@ -678,9 +678,9 @@ dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp) cdb = &sess->cdb; rte_memcpy(&c_cdb, cdb, sizeof(struct sec_cdb)); #ifdef RTE_LIB_SECURITY - printf("\nsession protocol type = %d\n", sess->proto_alg); + fprintf(f, "\nsession protocol type = %d\n", sess->proto_alg); #endif - printf("\n****************************************\n" + fprintf(f, "\n****************************************\n" "session params:\n\tContext type:\t%d\n\tDirection:\t%s\n" "\tCipher alg:\t%d\n\tAuth alg:\t%d\n\tAead alg:\t%d\n" "\tCipher key len:\t%"PRIu64"\n\tCipher alg:\t%d\n" @@ -689,11 +689,11 @@ dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp) sess->cipher_alg, sess->auth_alg, sess->aead_alg, (uint64_t)sess->cipher_key.length, sess->cipher_key.alg, sess->cipher_key.algmode); - rte_hexdump(stdout, "cipher key", sess->cipher_key.data, + rte_hexdump(f, "cipher key", sess->cipher_key.data, sess->cipher_key.length); - rte_hexdump(stdout, "auth key", sess->auth_key.data, + rte_hexdump(f, "auth key", sess->auth_key.data, sess->auth_key.length); - printf("\tAuth key len:\t%"PRIu64"\n\tAuth alg:\t%d\n" + fprintf(f, "\tAuth key len:\t%"PRIu64"\n\tAuth alg:\t%d\n" "\tAuth algmode:\t%d\n\tIV len:\t\t%d\n\tIV offset:\t%d\n" "\tdigest length:\t%d\n\tauth only len:\t\t%d\n" "\taead cipher text:\t%d\n", @@ -703,7 +703,7 @@ dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp) sess->digest_length, sess->auth_only_len, sess->auth_cipher_text); #ifdef RTE_LIB_SECURITY - printf("PDCP session params:\n" + fprintf(f, "PDCP session params:\n" "\tDomain:\t\t%d\n\tBearer:\t\t%d\n\tpkt_dir:\t%d\n\thfn_ovd:" "\t%d\n\tsn_size:\t%d\n\tsdap_enabled:\t%d\n\thfn_ovd_offset:" "\t%d\n\thfn:\t\t%d\n" @@ -717,63 +717,63 @@ dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp) c_cdb.sh_hdr.lo.word = rte_be_to_cpu_32(c_cdb.sh_hdr.lo.word); bufsize = c_cdb.sh_hdr.hi.field.idlen; - printf("cdb = %p\n\n", cdb); - printf("Descriptor size = %d\n", bufsize); + fprintf(f, "cdb = %p\n\n", cdb); + fprintf(f, "Descriptor size = %d\n", bufsize); int m; for (m = 0; m < bufsize; m++) - printf("0x%x\n", rte_be_to_cpu_32(c_cdb.sh_desc[m])); + fprintf(f, "0x%x\n", rte_be_to_cpu_32(c_cdb.sh_desc[m])); - printf("\n"); + fprintf(f, "\n"); mbuf_dump: sym_op = op->sym; if (sym_op->m_src) { - printf("Source mbuf:\n"); - rte_pktmbuf_dump(stdout, sym_op->m_src, + fprintf(f, "Source mbuf:\n"); + rte_pktmbuf_dump(f, sym_op->m_src, sym_op->m_src->data_len); } if (sym_op->m_dst) { - printf("Destination mbuf:\n"); - rte_pktmbuf_dump(stdout, sym_op->m_dst, + fprintf(f, "Destination mbuf:\n"); + rte_pktmbuf_dump(f, sym_op->m_dst, sym_op->m_dst->data_len); } - printf("Session address = %p\ncipher offset: %d, length: %d\n" + fprintf(f, "Session address = %p\ncipher offset: %d, length: %d\n" "auth offset: %d, length: %d\n aead offset: %d, length: %d\n", sym_op->session, sym_op->cipher.data.offset, sym_op->cipher.data.length, sym_op->auth.data.offset, sym_op->auth.data.length, sym_op->aead.data.offset, sym_op->aead.data.length); - printf("\n"); + fprintf(f, "\n"); - printf("******************************************************\n"); - printf("ctx info:\n"); - printf("job->sg[0] output info:\n"); + fprintf(f, "******************************************************\n"); + fprintf(f, "ctx info:\n"); + fprintf(f, "job->sg[0] output info:\n"); memcpy(&sg[0], &job->sg[0], sizeof(sg[0])); - printf("\taddr = %"PRIx64",\n\tlen = %d,\n\tfinal = %d,\n\textension = %d" + fprintf(f, "\taddr = %"PRIx64",\n\tlen = %d,\n\tfinal = %d,\n\textension = %d" "\n\tbpid = %d\n\toffset = %d\n", (uint64_t)sg[0].addr, sg[0].length, sg[0].final, sg[0].extension, sg[0].bpid, sg[0].offset); - printf("\njob->sg[1] input info:\n"); + fprintf(f, "\njob->sg[1] input info:\n"); memcpy(&sg[1], &job->sg[1], sizeof(sg[1])); hw_sg_to_cpu(&sg[1]); - printf("\taddr = %"PRIx64",\n\tlen = %d,\n\tfinal = %d,\n\textension = %d" + fprintf(f, "\taddr = %"PRIx64",\n\tlen = %d,\n\tfinal = %d,\n\textension = %d" "\n\tbpid = %d\n\toffset = %d\n", (uint64_t)sg[1].addr, sg[1].length, sg[1].final, sg[1].extension, sg[1].bpid, sg[1].offset); - printf("\nctx pool addr = %p\n", ctx->ctx_pool); + fprintf(f, "\nctx pool addr = %p\n", ctx->ctx_pool); if (ctx->ctx_pool) - printf("ctx pool available counts = %d\n", + fprintf(f, "ctx pool available counts = %d\n", rte_mempool_avail_count(ctx->ctx_pool)); - printf("\nop pool addr = %p\n", op->mempool); + fprintf(f, "\nop pool addr = %p\n", op->mempool); if (op->mempool) - printf("op pool available counts = %d\n", + fprintf(f, "op pool available counts = %d\n", rte_mempool_avail_count(op->mempool)); - printf("********************************************************\n"); - printf("Queue data:\n"); - printf("\tFQID = 0x%x\n\tstate = %d\n\tnb_desc = %d\n" + fprintf(f, "********************************************************\n"); + fprintf(f, "Queue data:\n"); + fprintf(f, "\tFQID = 0x%x\n\tstate = %d\n\tnb_desc = %d\n" "\tctx_pool = %p\n\trx_pkts = %d\n\ttx_pkts" "= %d\n\trx_errs = %d\n\ttx_errs = %d\n\n", qp->outq.fqid, qp->outq.state, qp->outq.nb_desc, @@ -852,7 +852,7 @@ dpaa_sec_deq(struct dpaa_sec_qp *qp, struct rte_crypto_op **ops, int nb_ops) DPAA_SEC_DP_WARN("SEC return err:0x%x\n", ctx->fd_status); if (dpaa_sec_dp_dump > DPAA_SEC_DP_ERR_DUMP) - dpaa_sec_dump(ctx, qp); + dpaa_sec_dump(ctx, qp, stdout); } op->status = RTE_CRYPTO_OP_STATUS_ERROR; } diff --git a/drivers/net/dpaa2/dpaa2_flow.c b/drivers/net/dpaa2/dpaa2_flow.c index eec7e60650..6c7bac4d48 100644 --- a/drivers/net/dpaa2/dpaa2_flow.c +++ b/drivers/net/dpaa2/dpaa2_flow.c @@ -236,7 +236,7 @@ static inline void dpaa2_prot_field_string( } static inline void dpaa2_flow_qos_table_extracts_log( - const struct dpaa2_dev_priv *priv) + const struct dpaa2_dev_priv *priv, FILE *f) { int idx; char string[32]; @@ -244,7 +244,7 @@ static inline void dpaa2_flow_qos_table_extracts_log( if (!dpaa2_flow_control_log) return; - printf("Setup QoS table: number of extracts: %d\r\n", + fprintf(f, "Setup QoS table: number of extracts: %d\r\n", priv->extract.qos_key_extract.dpkg.num_extracts); for (idx = 0; idx < priv->extract.qos_key_extract.dpkg.num_extracts; idx++) { @@ -253,15 +253,15 @@ static inline void dpaa2_flow_qos_table_extracts_log( priv->extract.qos_key_extract.dpkg.extracts[idx] .extract.from_hdr.field, string); - printf("%s", string); + fprintf(f, "%s", string); if ((idx + 1) < priv->extract.qos_key_extract.dpkg.num_extracts) - printf(" / "); + fprintf(f, " / "); } - printf("\r\n"); + fprintf(f, "\r\n"); } static inline void dpaa2_flow_fs_table_extracts_log( - const struct dpaa2_dev_priv *priv, int tc_id) + const struct dpaa2_dev_priv *priv, int tc_id, FILE *f) { int idx; char string[32]; @@ -269,7 +269,7 @@ static inline void dpaa2_flow_fs_table_extracts_log( if (!dpaa2_flow_control_log) return; - printf("Setup FS table: number of extracts of TC[%d]: %d\r\n", + fprintf(f, "Setup FS table: number of extracts of TC[%d]: %d\r\n", tc_id, priv->extract.tc_key_extract[tc_id] .dpkg.num_extracts); for (idx = 0; idx < priv->extract.tc_key_extract[tc_id] @@ -279,16 +279,16 @@ static inline void dpaa2_flow_fs_table_extracts_log( priv->extract.tc_key_extract[tc_id].dpkg.extracts[idx] .extract.from_hdr.field, string); - printf("%s", string); + fprintf(f, "%s", string); if ((idx + 1) < priv->extract.tc_key_extract[tc_id] .dpkg.num_extracts) - printf(" / "); + fprintf(f, " / "); } - printf("\r\n"); + fprintf(f, "\r\n"); } static inline void dpaa2_flow_qos_entry_log( - const char *log_info, const struct rte_flow *flow, int qos_index) + const char *log_info, const struct rte_flow *flow, int qos_index, FILE *f) { int idx; uint8_t *key, *mask; @@ -296,27 +296,27 @@ static inline void dpaa2_flow_qos_entry_log( if (!dpaa2_flow_control_log) return; - printf("\r\n%s QoS entry[%d] for TC[%d], extracts size is %d\r\n", + fprintf(f, "\r\n%s QoS entry[%d] for TC[%d], extracts size is %d\r\n", log_info, qos_index, flow->tc_id, flow->qos_real_key_size); key = (uint8_t *)(size_t)flow->qos_rule.key_iova; mask = (uint8_t *)(size_t)flow->qos_rule.mask_iova; - printf("key:\r\n"); + fprintf(f, "key:\r\n"); for (idx = 0; idx < flow->qos_real_key_size; idx++) - printf("%02x ", key[idx]); + fprintf(f, "%02x ", key[idx]); - printf("\r\nmask:\r\n"); + fprintf(f, "\r\nmask:\r\n"); for (idx = 0; idx < flow->qos_real_key_size; idx++) - printf("%02x ", mask[idx]); + fprintf(f, "%02x ", mask[idx]); - printf("\r\n%s QoS ipsrc: %d, ipdst: %d\r\n", log_info, + fprintf(f, "\r\n%s QoS ipsrc: %d, ipdst: %d\r\n", log_info, flow->ipaddr_rule.qos_ipsrc_offset, flow->ipaddr_rule.qos_ipdst_offset); } static inline void dpaa2_flow_fs_entry_log( - const char *log_info, const struct rte_flow *flow) + const char *log_info, const struct rte_flow *flow, FILE *f) { int idx; uint8_t *key, *mask; @@ -324,21 +324,21 @@ static inline void dpaa2_flow_fs_entry_log( if (!dpaa2_flow_control_log) return; - printf("\r\n%s FS/TC entry[%d] of TC[%d], extracts size is %d\r\n", + fprintf(f, "\r\n%s FS/TC entry[%d] of TC[%d], extracts size is %d\r\n", log_info, flow->tc_index, flow->tc_id, flow->fs_real_key_size); key = (uint8_t *)(size_t)flow->fs_rule.key_iova; mask = (uint8_t *)(size_t)flow->fs_rule.mask_iova; - printf("key:\r\n"); + fprintf(f, "key:\r\n"); for (idx = 0; idx < flow->fs_real_key_size; idx++) - printf("%02x ", key[idx]); + fprintf(f, "%02x ", key[idx]); - printf("\r\nmask:\r\n"); + fprintf(f, "\r\nmask:\r\n"); for (idx = 0; idx < flow->fs_real_key_size; idx++) - printf("%02x ", mask[idx]); + fprintf(f, "%02x ", mask[idx]); - printf("\r\n%s FS ipsrc: %d, ipdst: %d\r\n", log_info, + fprintf(f, "\r\n%s FS ipsrc: %d, ipdst: %d\r\n", log_info, flow->ipaddr_rule.fs_ipsrc_offset, flow->ipaddr_rule.fs_ipdst_offset); } @@ -3017,7 +3017,7 @@ dpaa2_flow_entry_update( qos_index = curr->tc_id * priv->fs_entries + curr->tc_index; - dpaa2_flow_qos_entry_log("Before update", curr, qos_index); + dpaa2_flow_qos_entry_log("Before update", curr, qos_index, stdout); if (priv->num_rx_tc > 1) { ret = dpni_remove_qos_entry(dpni, CMD_PRI_LOW, @@ -3124,7 +3124,7 @@ dpaa2_flow_entry_update( curr->qos_rule.key_size = FIXED_ENTRY_SIZE; - dpaa2_flow_qos_entry_log("Start update", curr, qos_index); + dpaa2_flow_qos_entry_log("Start update", curr, qos_index, stdout); if (priv->num_rx_tc > 1) { ret = dpni_add_qos_entry(dpni, CMD_PRI_LOW, @@ -3142,7 +3142,7 @@ dpaa2_flow_entry_update( continue; } - dpaa2_flow_fs_entry_log("Before update", curr); + dpaa2_flow_fs_entry_log("Before update", curr, stdout); extend = -1; ret = dpni_remove_fs_entry(dpni, CMD_PRI_LOW, @@ -3237,7 +3237,7 @@ dpaa2_flow_entry_update( curr->fs_real_key_size += extend; curr->fs_rule.key_size = FIXED_ENTRY_SIZE; - dpaa2_flow_fs_entry_log("Start update", curr); + dpaa2_flow_fs_entry_log("Start update", curr, stdout); ret = dpni_add_fs_entry(dpni, CMD_PRI_LOW, priv->token, curr->tc_id, curr->tc_index, @@ -3541,7 +3541,8 @@ dpaa2_generic_flow_set(struct rte_flow *flow, /* Configure FS table first*/ if (is_keycfg_configured & DPAA2_FS_TABLE_RECONFIGURE) { - dpaa2_flow_fs_table_extracts_log(priv, flow->tc_id); + dpaa2_flow_fs_table_extracts_log(priv, + flow->tc_id, stdout); if (dpkg_prepare_key_cfg( &priv->extract.tc_key_extract[flow->tc_id].dpkg, (uint8_t *)(size_t)priv->extract @@ -3580,7 +3581,7 @@ dpaa2_generic_flow_set(struct rte_flow *flow, /* Configure QoS table then.*/ if (is_keycfg_configured & DPAA2_QOS_TABLE_RECONFIGURE) { - dpaa2_flow_qos_table_extracts_log(priv); + dpaa2_flow_qos_table_extracts_log(priv, stdout); if (dpkg_prepare_key_cfg( &priv->extract.qos_key_extract.dpkg, (uint8_t *)(size_t)priv->extract.qos_extract_param) < 0) { @@ -3646,7 +3647,8 @@ dpaa2_generic_flow_set(struct rte_flow *flow, } flow->qos_rule.key_size = FIXED_ENTRY_SIZE; - dpaa2_flow_qos_entry_log("Start add", flow, qos_index); + dpaa2_flow_qos_entry_log("Start add", flow, + qos_index, stdout); ret = dpni_add_qos_entry(dpni, CMD_PRI_LOW, priv->token, &flow->qos_rule, @@ -3697,7 +3699,7 @@ dpaa2_generic_flow_set(struct rte_flow *flow, flow->fs_rule.key_size = FIXED_ENTRY_SIZE; - dpaa2_flow_fs_entry_log("Start add", flow); + dpaa2_flow_fs_entry_log("Start add", flow, stdout); ret = dpni_add_fs_entry(dpni, CMD_PRI_LOW, priv->token, flow->tc_id, flow->tc_index, -- 2.25.1 ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v4 1/3] drivers: replace printf with log macros 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 ` David Marchand 2 siblings, 0 replies; 22+ messages in thread From: David Marchand @ 2024-07-03 14:54 UTC (permalink / raw) To: Hemant Agrawal; +Cc: dev, thomas, stephen On Wed, Jul 3, 2024 at 2:17 PM Hemant Agrawal <hemant.agrawal@nxp.com> wrote: > > 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> Series applied, thanks Hemant. -- David Marchand ^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2024-07-03 14:55 UTC | newest] Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-02-15 10:29 [PATCH 1/2] drivers: replace printf with log macros 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 ` [PATCH v3 1/3] " Hemant Agrawal 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
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).