Skip to content

Commit 1820f1c

Browse files
committed
Modify some ff_log code.
1 parent 8c615df commit 1820f1c

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

example/main_zc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ int loop(void *arg)
202202
/* Or call ff_zc_mbuf_write one time */
203203
/*
204204
if (ret != buf_len) {
205-
printf("ff_zc_mbuf_write failed, len:%d, errno:%d, %s\n", buf_len, errno, strerror(errno));
205+
ff_log(FF_LOG_ERR, FF_LOGTYPE_FSTACK_APP, "ff_zc_mbuf_write failed, len:%d, errno:%d, %s\n", buf_len, errno, strerror(errno));
206206
exit(1);
207207
}
208208
*/

lib/ff_dpdk_if.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ init_port_start(void)
781781
static uint16_t nb_txd = TX_QUEUE_SIZE;
782782
ret = rte_eth_dev_adjust_nb_rx_tx_desc(port_id, &nb_rxd, &nb_txd);
783783
if (ret < 0)
784-
ff_log(FF_LOG_INFO, FF_LOGTYPE_FSTACK_LIB, "Could not adjust number of descriptors "
784+
ff_log(FF_LOG_ERR, FF_LOGTYPE_FSTACK_LIB, "Could not adjust number of descriptors "
785785
"for port%u (%d)\n", (unsigned)port_id, ret);
786786

787787
uint16_t q;
@@ -855,7 +855,7 @@ init_port_start(void)
855855
if (ret == 0) {
856856
ff_log(FF_LOG_INFO, FF_LOGTYPE_FSTACK_LIB, "set port %u to promiscuous mode ok\n", port_id);
857857
} else {
858-
ff_log(FF_LOG_INFO, FF_LOGTYPE_FSTACK_LIB, "set port %u to promiscuous mode error\n", port_id);
858+
ff_log(FF_LOG_ERR, FF_LOGTYPE_FSTACK_LIB, "set port %u to promiscuous mode error\n", port_id);
859859
}
860860
}
861861
}
@@ -918,7 +918,7 @@ port_flow_complain(struct rte_flow_error *error)
918918
errstr = "unknown type";
919919
else
920920
errstr = errstrlist[error->type];
921-
ff_log(FF_LOG_INFO, FF_LOGTYPE_FSTACK_LIB, "Caught error type %d (%s): %s%s: %s\n",
921+
ff_log(FF_LOG_ERR, FF_LOGTYPE_FSTACK_LIB, "Caught error type %d (%s): %s%s: %s\n",
922922
error->type, errstr,
923923
error->cause ? (snprintf(buf, sizeof(buf), "cause: %p, ",
924924
error->cause), buf) : "",
@@ -1202,7 +1202,7 @@ create_ipip_flow(uint16_t port_id) {
12021202
ff_log(FF_LOG_ERR, FF_LOGTYPE_FSTACK_LIB, "Flow rule validation failed: %s\n", error.message);
12031203
return -error.type;
12041204
}
1205-
ff_log(FF_LOG_ERR, FF_LOGTYPE_FSTACK_LIB, "IPIP flow rule created successfully (port %d, RSS level=%d)\n", port_id, rss.level);
1205+
ff_log(FF_LOG_INFO, FF_LOGTYPE_FSTACK_LIB, "IPIP flow rule created successfully (port %d, RSS level=%d)\n", port_id, rss.level);
12061206
return 0;
12071207
}
12081208
#endif

lib/ff_log.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,10 @@ ff_log_open_set(void)
6767
void
6868
ff_log_close(void)
6969
{
70-
if (ff_global_cfg.log.f)
70+
if (ff_global_cfg.log.f) {
7171
fclose(ff_global_cfg.log.f);
72+
ff_global_cfg.log.f = NULL;
73+
}
7274
}
7375

7476
int

0 commit comments

Comments
 (0)