@@ -29,14 +29,14 @@ int ipc_odp_packet_send_or_free(odp_pktio_t pktio,
end_time = odp_time_sum(start_time, wait);
if (odp_pktout_queue(pktio, &pktout, 1) != 1) {
- EXAMPLE_ERR("no output queue\n");
+ LOG_ERR("no output queue\n");
return -1;
}
while (sent != num) {
ret = odp_pktout_send(pktout, &pkt_tbl[sent], num - sent);
if (ret < 0) {
- EXAMPLE_ERR("odp_pktout_send return %d\n", ret);
+ LOG_ERR("odp_pktout_send return %d\n", ret);
for (i = sent; i < num; i++)
odp_packet_free(pkt_tbl[i]);
return -1;
@@ -47,7 +47,7 @@ int ipc_odp_packet_send_or_free(odp_pktio_t pktio,
if (odp_time_cmp(end_time, odp_time_local()) < 0) {
for (i = sent; i < num; i++)
odp_packet_free(pkt_tbl[i]);
- EXAMPLE_ERR("Send Timeout!\n");
+ LOG_ERR("Send Timeout!\n");
return -1;
}
}
@@ -71,17 +71,17 @@ odp_pktio_t create_pktio(odp_pool_t pool, int master_pid)
printf("pid: %d, create IPC pktio %s\n", getpid(), name);
ipc_pktio = odp_pktio_open(name, pool, &pktio_param);
if (ipc_pktio == ODP_PKTIO_INVALID) {
- EXAMPLE_ERR("Error: ipc pktio %s create failed.\n", name);
+ LOG_ERR("Error: ipc pktio %s create failed.\n", name);
return ODP_PKTIO_INVALID;
}
if (odp_pktin_queue_config(ipc_pktio, NULL)) {
- EXAMPLE_ERR("Input queue config failed\n");
+ LOG_ERR("Input queue config failed\n");
return ODP_PKTIO_INVALID;
}
if (odp_pktout_queue_config(ipc_pktio, NULL)) {
- EXAMPLE_ERR("Output queue config failed\n");
+ LOG_ERR("Output queue config failed\n");
return ODP_PKTIO_INVALID;
}
@@ -20,7 +20,7 @@
#include <signal.h>
#include <sys/wait.h>
-#include <example_debug.h>
+#include <test_debug.h>
#include <odp.h>
#include <odp/helper/odph_api.h>
@@ -77,7 +77,7 @@ static int pktio_run_loop(odp_pool_t pool)
return -1;
if (odp_pktin_queue(ipc_pktio, &pktin, 1) != 1) {
- EXAMPLE_ERR("no input queue\n");
+ LOG_ERR("no input queue\n");
return -1;
}
@@ -107,8 +107,8 @@ static int pktio_run_loop(odp_pool_t pool)
cycle = odp_time_local();
diff = odp_time_diff(cycle, start_cycle);
if (odp_time_cmp(wait, diff) < 0) {
- EXAMPLE_DBG("exit after %d seconds\n",
- run_time_sec);
+ LOG_DBG("exit after %d seconds\n",
+ run_time_sec);
break;
}
}
@@ -132,7 +132,7 @@ static int pktio_run_loop(odp_pool_t pool)
stat_errors++;
stat_free++;
odp_packet_free(pkt);
- EXAMPLE_ERR("invalid l4 offset\n");
+ LOG_ERR("invalid l4 offset\n");
}
off += ODPH_UDPHDR_LEN;
@@ -143,7 +143,7 @@ static int pktio_run_loop(odp_pool_t pool)
stat_errors++;
stat_free++;
odp_packet_free(pkt);
- EXAMPLE_DBG("error\n");
+ LOG_DBG("error\n");
continue;
}
@@ -157,7 +157,7 @@ static int pktio_run_loop(odp_pool_t pool)
stat_errors++;
stat_free++;
odp_packet_free(pkt);
- EXAMPLE_DBG("error\n");
+ LOG_DBG("error\n");
continue;
}
@@ -184,7 +184,7 @@ static int pktio_run_loop(odp_pool_t pool)
if (head.seq != cnt_recv && sync_cnt) {
stat_errors++;
odp_packet_free(pkt);
- EXAMPLE_DBG("head.seq %d - "
+ LOG_DBG("head.seq %d - "
"cnt_recv %" PRIu64 ""
" = %" PRIu64 "\n",
head.seq, cnt_recv,
@@ -226,7 +226,7 @@ static int pktio_run_loop(odp_pool_t pool)
off = odp_packet_l4_offset(pkt);
if (off == ODP_PACKET_OFFSET_INVALID)
- EXAMPLE_ABORT("packet L4 offset not set");
+ LOG_ABORT("packet L4 offset not set");
head.magic = TEST_SEQ_MAGIC;
head.seq = cnt++;
@@ -235,20 +235,20 @@ static int pktio_run_loop(odp_pool_t pool)
ret = odp_packet_copy_from_mem(pkt, off, sizeof(head),
&head);
if (ret)
- EXAMPLE_ABORT("unable to copy in head data");
+ LOG_ABORT("unable to copy in head data");
tail.magic = TEST_SEQ_MAGIC;
off = odp_packet_len(pkt) - sizeof(pkt_tail_t);
ret = odp_packet_copy_from_mem(pkt, off, sizeof(tail),
&tail);
if (ret)
- EXAMPLE_ABORT("unable to copy in tail data");
+ LOG_ABORT("unable to copy in tail data");
}
/* 5. Send packets to ipc_pktio */
ret = ipc_odp_packet_send_or_free(ipc_pktio, pkt_tbl, pkts);
if (ret < 0) {
- EXAMPLE_DBG("unable to sending to ipc pktio\n");
+ LOG_DBG("unable to sending to ipc pktio\n");
break;
}
@@ -275,14 +275,14 @@ static int pktio_run_loop(odp_pool_t pool)
/* cleanup and exit */
ret = odp_pktio_stop(ipc_pktio);
if (ret) {
- EXAMPLE_DBG("odp_pktio_stop error %d\n", ret);
+ LOG_DBG("odp_pktio_stop error %d\n", ret);
return -1;
}
exit:
ret = odp_pktio_close(ipc_pktio);
if (ret) {
- EXAMPLE_DBG("odp_pktio_close error %d\n", ret);
+ LOG_DBG("odp_pktio_close error %d\n", ret);
return -1;
}
@@ -308,7 +308,7 @@ int main(int argc, char *argv[])
/* Init ODP before calling anything else */
if (odp_init_global(&instance, NULL, NULL)) {
- EXAMPLE_ERR("Error: ODP global init failed.\n");
+ LOG_ERR("Error: ODP global init failed.\n");
exit(EXIT_FAILURE);
}
@@ -329,7 +329,7 @@ int main(int argc, char *argv[])
/* Init this thread */
if (odp_init_local(instance, ODP_THREAD_WORKER)) {
- EXAMPLE_ERR("Error: ODP local init failed.\n");
+ LOG_ERR("Error: ODP local init failed.\n");
exit(EXIT_FAILURE);
}
@@ -345,7 +345,7 @@ int main(int argc, char *argv[])
pool = odp_pool_create(TEST_IPC_POOL_NAME, ¶ms);
if (pool == ODP_POOL_INVALID) {
- EXAMPLE_ERR("Error: packet pool create failed.\n");
+ LOG_ERR("Error: packet pool create failed.\n");
exit(EXIT_FAILURE);
}
@@ -354,20 +354,20 @@ int main(int argc, char *argv[])
ret = pktio_run_loop(pool);
if (odp_pool_destroy(pool)) {
- EXAMPLE_ERR("Error: odp_pool_destroy() failed.\n");
+ LOG_ERR("Error: odp_pool_destroy() failed.\n");
exit(EXIT_FAILURE);
}
if (odp_term_local()) {
- EXAMPLE_ERR("Error: odp_term_local() failed.\n");
+ LOG_ERR("Error: odp_term_local() failed.\n");
exit(EXIT_FAILURE);
}
if (odp_term_global(instance)) {
- EXAMPLE_ERR("Error: odp_term_global() failed.\n");
+ LOG_ERR("Error: odp_term_global() failed.\n");
exit(EXIT_FAILURE);
}
- EXAMPLE_DBG("return %d\n", ret);
+ LOG_DBG("return %d\n", ret);
return ret;
}
@@ -44,7 +44,7 @@ static int ipc_second_process(int master_pid)
pool = odp_pool_create(TEST_IPC_POOL_NAME, ¶ms);
if (pool == ODP_POOL_INVALID) {
- EXAMPLE_ERR("Error: packet pool create failed.\n");
+ LOG_ERR("Error: packet pool create failed.\n");
exit(EXIT_FAILURE);
}
@@ -77,7 +77,7 @@ static int ipc_second_process(int master_pid)
if (odp_pktin_queue(ipc_pktio, &pktin, 1) != 1) {
odp_pool_destroy(pool);
- EXAMPLE_ERR("no input queue\n");
+ LOG_ERR("no input queue\n");
return -1;
}
@@ -105,8 +105,8 @@ static int ipc_second_process(int master_pid)
cycle = odp_time_local();
diff = odp_time_diff(cycle, start_cycle);
if (odp_time_cmp(wait, diff) < 0) {
- EXAMPLE_DBG("exit after %d seconds\n",
- run_time_sec);
+ LOG_DBG("exit after %d seconds\n",
+ run_time_sec);
break;
}
}
@@ -123,7 +123,7 @@ static int ipc_second_process(int master_pid)
off = odp_packet_l4_offset(pkt);
if (off == ODP_PACKET_OFFSET_INVALID) {
- EXAMPLE_ERR("invalid l4 offset\n");
+ LOG_ERR("invalid l4 offset\n");
for (int j = i; j < pkts; j++)
odp_packet_free(pkt_tbl[j]);
break;
@@ -133,10 +133,10 @@ static int ipc_second_process(int master_pid)
ret = odp_packet_copy_to_mem(pkt, off, sizeof(head),
&head);
if (ret)
- EXAMPLE_ABORT("unable copy out head data");
+ LOG_ABORT("unable copy out head data");
if (head.magic != TEST_SEQ_MAGIC) {
- EXAMPLE_ERR("Wrong head magic! %x", head.magic);
+ LOG_ERR("Wrong head magic! %x", head.magic);
for (int j = i; j < pkts; j++)
odp_packet_free(pkt_tbl[j]);
break;
@@ -147,13 +147,13 @@ static int ipc_second_process(int master_pid)
ret = odp_packet_copy_from_mem(pkt, off, sizeof(head),
&head);
if (ret)
- EXAMPLE_ABORT("unable to copy in head data");
+ LOG_ABORT("unable to copy in head data");
}
/* send all packets back */
ret = ipc_odp_packet_send_or_free(ipc_pktio, pkt_tbl, i);
if (ret < 0)
- EXAMPLE_ABORT("can not send packets\n");
+ LOG_ABORT("can not send packets\n");
stat_pkts += ret;
@@ -174,13 +174,13 @@ static int ipc_second_process(int master_pid)
sizeof(head),
&head);
if (ret)
- EXAMPLE_ABORT("unable to copy in head data");
+ LOG_ABORT("unable to copy in head data");
pkt_tbl[0] = alloc_pkt;
ret = ipc_odp_packet_send_or_free(ipc_pktio,
pkt_tbl, 1);
if (ret < 0)
- EXAMPLE_ABORT("can not send packets\n");
+ LOG_ABORT("can not send packets\n");
stat_pkts += 1;
}
}
@@ -188,20 +188,20 @@ static int ipc_second_process(int master_pid)
/* cleanup and exit */
ret = odp_pktio_stop(ipc_pktio);
if (ret) {
- EXAMPLE_DBG("ipc2: odp_pktio_stop error %d\n", ret);
+ LOG_DBG("ipc2: odp_pktio_stop error %d\n", ret);
return -1;
}
not_started:
ret = odp_pktio_close(ipc_pktio);
if (ret) {
- EXAMPLE_DBG("ipc2: odp_pktio_close error %d\n", ret);
+ LOG_DBG("ipc2: odp_pktio_close error %d\n", ret);
return -1;
}
ret = odp_pool_destroy(pool);
if (ret)
- EXAMPLE_DBG("ipc2: pool_destroy error %d\n", ret);
+ LOG_DBG("ipc2: pool_destroy error %d\n", ret);
return stat_pkts > 1000 ? 0 : -1;
}
@@ -219,7 +219,7 @@ int main(int argc, char *argv[])
parse_args(argc, argv);
if (odp_init_global(&instance, NULL, NULL)) {
- EXAMPLE_ERR("Error: ODP global init failed.\n");
+ LOG_ERR("Error: ODP global init failed.\n");
exit(EXIT_FAILURE);
}
@@ -243,19 +243,19 @@ int main(int argc, char *argv[])
/* Init this thread */
if (odp_init_local(instance, ODP_THREAD_WORKER)) {
- EXAMPLE_ERR("Error: ODP local init failed.\n");
+ LOG_ERR("Error: ODP local init failed.\n");
exit(EXIT_FAILURE);
}
ret = ipc_second_process(master_pid);
if (odp_term_local()) {
- EXAMPLE_ERR("Error: odp_term_local() failed.\n");
+ LOG_ERR("Error: odp_term_local() failed.\n");
exit(EXIT_FAILURE);
}
if (odp_term_global(instance)) {
- EXAMPLE_ERR("Error: odp_term_global() failed.\n");
+ LOG_ERR("Error: odp_term_global() failed.\n");
exit(EXIT_FAILURE);
}