1 Index: dpdk/lib/librte_eal/common/eal_common_log.c
2 ===================================================================
3 --- dpdk.orig/lib/librte_eal/common/eal_common_log.c
4 +++ dpdk/lib/librte_eal/common/eal_common_log.c
5 @@ -57,9 +57,10 @@ static FILE *default_log_stream;
7 uint32_t loglevel; /**< log level - see rte_log.h */
8 uint32_t logtype; /**< log type - see rte_log.h */
9 -} __rte_cache_aligned;
10 -static struct log_cur_msg log_cur_msg[RTE_MAX_LCORE]; /**< per core log */
14 +static RTE_DEFINE_PER_LCORE(struct log_cur_msg, log_cur_msg);
18 @@ -121,21 +122,13 @@ rte_get_log_type(void)
19 /* get the current loglevel for the message beeing processed */
20 int rte_log_cur_msg_loglevel(void)
23 - lcore_id = rte_lcore_id();
24 - if (lcore_id >= RTE_MAX_LCORE)
25 - return rte_get_log_level();
26 - return log_cur_msg[lcore_id].loglevel;
27 + return RTE_PER_LCORE(log_cur_msg).loglevel;
30 /* get the current logtype for the message beeing processed */
31 int rte_log_cur_msg_logtype(void)
34 - lcore_id = rte_lcore_id();
35 - if (lcore_id >= RTE_MAX_LCORE)
36 - return rte_get_log_type();
37 - return log_cur_msg[lcore_id].logtype;
38 + return RTE_PER_LCORE(log_cur_msg).logtype;
41 /* Dump log history to file */
42 @@ -153,17 +146,13 @@ rte_vlog(uint32_t level, uint32_t logtyp
45 FILE *f = rte_logs.file;
48 if ((level > rte_logs.level) || !(logtype & rte_logs.type))
51 /* save loglevel and logtype in a global per-lcore variable */
52 - lcore_id = rte_lcore_id();
53 - if (lcore_id < RTE_MAX_LCORE) {
54 - log_cur_msg[lcore_id].loglevel = level;
55 - log_cur_msg[lcore_id].logtype = logtype;
57 + RTE_PER_LCORE(log_cur_msg).loglevel = level;
58 + RTE_PER_LCORE(log_cur_msg).logtype = logtype;
60 ret = vfprintf(f, format, ap);