From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: dev@dpdk.org, thomas@monjalon.net, stephen@networkplumber.org,
david.marchand@redhat.com
Subject: [PATCH v3 3/3] drivers: replace printf with fprintf for debug functions
Date: Tue, 2 Jul 2024 18:38:56 +0530 [thread overview]
Message-ID: <20240702130856.3927348-3-hemant.agrawal@nxp.com> (raw)
In-Reply-To: <20240702130856.3927348-1-hemant.agrawal@nxp.com>
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
next prev parent reply other threads:[~2024-07-02 13:09 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-15 10:29 [PATCH 1/2] 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 ` Hemant Agrawal [this message]
2024-07-03 10:41 ` [PATCH v3 1/3] drivers: replace printf with log macros David Marchand
2024-07-03 12:02 ` Hemant Agrawal
2024-07-03 12:11 ` David Marchand
2024-07-03 12:16 ` [PATCH v4 " Hemant Agrawal
2024-07-03 12:16 ` [PATCH v4 2/3] drivers: dpaa: remove double newline Hemant Agrawal
2024-07-03 12:16 ` [PATCH v4 3/3] drivers: replace printf with fprintf for debug functions Hemant Agrawal
2024-07-03 14:54 ` [PATCH v4 1/3] drivers: replace printf with log macros David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240702130856.3927348-3-hemant.agrawal@nxp.com \
--to=hemant.agrawal@nxp.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).