@@ -20,6 +20,7 @@ LDLIBS += -lrte_mbuf -lrte_cryptodev
# library source files
SRCS-y += rte_eventdev.c
SRCS-y += rte_eventmode_helper.c
+SRCS-y += rte_eventmode_helper_prints.c
SRCS-y += rte_event_ring.c
SRCS-y += rte_event_eth_rx_adapter.c
SRCS-y += rte_event_timer_adapter.c
@@ -832,6 +832,9 @@ rte_eventmode_helper_initialize_devs(
return -1;
}
+ /* Display the current conf */
+ rte_eventmode_helper_display_conf(mode_conf);
+
/* Stop eth devices before setting up adapter */
RTE_ETH_FOREACH_DEV(portid) {
@@ -96,5 +96,15 @@ int32_t
rte_eventmode_helper_initialize_devs(
struct rte_eventmode_helper_conf *mode_conf);
+/**
+ * Display event mode conf
+ *
+ * Parse the conf and display the current configuration.
+ *
+ * @param mode_conf
+ * Configuration of the mode in which app is doing packet handling
+ */
+void
+rte_eventmode_helper_display_conf(struct rte_eventmode_helper_conf *mode_conf);
#endif /* _RTE_EVENTMODE_HELPER_H_ */
new file mode 100644
@@ -0,0 +1,161 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Cavium, Inc
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include <rte_eventmode_helper.h>
+#include "rte_eventmode_helper_internal.h"
+
+static void
+rte_eventmode_display_operating_mode(struct eventmode_conf *em_conf)
+{
+ char sched_types[][32] = {
+ "RTE_SCHED_TYPE_ORDERED",
+ "RTE_SCHED_TYPE_ATOMIC",
+ "RTE_SCHED_TYPE_PARALLEL",
+ };
+ RTE_EM_HLPR_LOG_INFO("Operating mode:");
+
+ RTE_EM_HLPR_LOG_INFO("\tScheduling type: \t%s",
+ sched_types[em_conf->ext_params.s1_sched_type]);
+
+ RTE_EM_HLPR_LOG_INFO("");
+}
+
+static void
+rte_eventmode_display_event_dev_conf(struct eventmode_conf *em_conf)
+{
+ int i;
+ char print_buf[256] = { 0 };
+ char queue_mode[][32] = {
+ "",
+ "ATQ (ALL TYPE QUEUE)",
+ "SINGLE LINK",
+ };
+
+ RTE_EM_HLPR_LOG_INFO("Event Device Configuration:");
+
+ for (i = 0; i < em_conf->nb_eventdev; i++) {
+ sprintf(print_buf,
+ "\tDev ID: %-2d \tQueues: %-2d \tPorts: %-2d",
+ em_conf->eventdev_config[i].eventdev_id,
+ em_conf->eventdev_config[i].nb_eventqueue,
+ em_conf->eventdev_config[i].nb_eventport);
+ sprintf(print_buf + strlen(print_buf),
+ "\tQueue mode: %s",
+ queue_mode[em_conf->eventdev_config[i].ev_queue_mode]);
+ RTE_EM_HLPR_LOG_INFO("%s", print_buf);
+ }
+ RTE_EM_HLPR_LOG_INFO("");
+}
+
+static void
+rte_eventmode_display_rx_adapter_conf(struct eventmode_conf *em_conf)
+{
+ int i, j;
+ int nb_rx_adapter = em_conf->nb_rx_adapter;
+ struct rx_adapter_conf *adapter;
+ struct adapter_connection_info *conn;
+ char print_buf[256] = { 0 };
+
+ RTE_EM_HLPR_LOG_INFO("Adapters configured: %d", nb_rx_adapter);
+
+ for (i = 0; i < nb_rx_adapter; i++) {
+ adapter = &(em_conf->adapter[i]);
+ RTE_EM_HLPR_LOG_INFO(
+ "\tAdaper ID: %-2d\tConnections: %-2d\tEvent dev ID: %-2d"
+ "\tRx core: %-2d",
+ adapter->adapter_id,
+ adapter->nb_connections,
+ adapter->eventdev_id,
+ adapter->rx_core_id);
+
+ for (j = 0; j < adapter->nb_connections; j++) {
+ conn = &(adapter->conn[j]);
+
+ sprintf(print_buf,
+ "\t\tEthdev ID: %-2d", conn->ethdev_id);
+
+ if (conn->ethdev_rx_qid == -1)
+ sprintf(print_buf + strlen(print_buf),
+ "\tEth rx queue: %-2s", "ALL");
+ else
+ sprintf(print_buf + strlen(print_buf),
+ "\tEth rx queue: %-2d",
+ conn->ethdev_rx_qid);
+
+ sprintf(print_buf + strlen(print_buf),
+ "\tEvent queue: %-2d", conn->eventq_id);
+ RTE_EM_HLPR_LOG_INFO("%s", print_buf);
+ }
+ }
+ RTE_EM_HLPR_LOG_INFO("");
+}
+
+static void
+rte_eventmode_display_link_conf(struct eventmode_conf *em_conf)
+{
+ int i;
+ struct rte_eventmode_helper_event_link_info *link;
+ char print_buf[256] = { 0 };
+
+ RTE_EM_HLPR_LOG_INFO("Links configured: %d", em_conf->nb_link);
+
+ for (i = 0; i < em_conf->nb_link; i++) {
+ link = &(em_conf->link[i]);
+
+ sprintf(print_buf,
+ "\tEvent dev ID: %-2d\tEvent port: %-2d",
+ link->eventdev_id,
+ link->event_portid);
+
+ if (em_conf->ext_params.all_ev_queue_to_ev_port)
+ sprintf(print_buf + strlen(print_buf),
+ "Event queue: %-2s\t", "ALL");
+ else
+ sprintf(print_buf + strlen(print_buf),
+ "Event queue: %-2d\t", link->eventq_id);
+
+ sprintf(print_buf + strlen(print_buf),
+ "Lcore: %-2d", link->lcore_id);
+ RTE_EM_HLPR_LOG_INFO("%s", print_buf);
+ }
+ RTE_EM_HLPR_LOG_INFO("");
+}
+
+void
+rte_eventmode_helper_display_conf(struct rte_eventmode_helper_conf *mode_conf)
+{
+ struct eventmode_conf *em_conf;
+
+ if (mode_conf == NULL) {
+ RTE_EM_HLPR_LOG_ERR("Invalid conf");
+ return;
+ }
+
+ if (mode_conf->mode != RTE_EVENTMODE_HELPER_PKT_TRANSFER_MODE_EVENT)
+ return;
+
+ if (mode_conf->mode_params == NULL) {
+ RTE_EM_HLPR_LOG_ERR("Invalid mode params");
+ return;
+ }
+
+ /* Get eventmode conf */
+ em_conf = (struct eventmode_conf *)(mode_conf->mode_params);
+
+ /* Display user exposed operating modes */
+ rte_eventmode_display_operating_mode(em_conf);
+
+ /* Display event device conf */
+ rte_eventmode_display_event_dev_conf(em_conf);
+
+ /* Display rx adapter conf */
+ rte_eventmode_display_rx_adapter_conf(em_conf);
+
+ /* Display event-lcore link */
+ rte_eventmode_display_link_conf(em_conf);
+}
+