DPDK patches and discussions
 help / color / mirror / Atom feed
From: Anoob Joseph <anoobj@marvell.com>
To: Akhil Goyal <akhil.goyal@nxp.com>, Radu Nicolau <radu.nicolau@intel.com>
Cc: Anoob Joseph <anoobj@marvell.com>,
	Thomas Monjalon <thomas@monjalon.net>,
	 Jerin Jacob <jerinj@marvell.com>,
	Narayana Prasad <pathreya@marvell.com>, <dev@dpdk.org>,
	Lukasz Bartosik <lbartosik@marvell.com>
Subject: [dpdk-dev] [RFC PATCH 05/13] examples/ipsec-secgw: add routines to display config
Date: Wed, 9 Oct 2019 20:40:08 +0530	[thread overview]
Message-ID: <1570633816-4706-6-git-send-email-anoobj@marvell.com> (raw)
In-Reply-To: <1570633816-4706-1-git-send-email-anoobj@marvell.com>

Add routines to display the eventmode configuration. This gives an
overview of the devices used.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Lukasz Bartosik <lbartosik@marvell.com>
---
 examples/ipsec-secgw/event_helper.c | 207 ++++++++++++++++++++++++++++++++++++
 examples/ipsec-secgw/event_helper.h |  14 +++
 2 files changed, 221 insertions(+)

diff --git a/examples/ipsec-secgw/event_helper.c b/examples/ipsec-secgw/event_helper.c
index 7745fbb..c43360e 100644
--- a/examples/ipsec-secgw/event_helper.c
+++ b/examples/ipsec-secgw/event_helper.c
@@ -868,6 +868,210 @@ eh_initialize_tx_adapter(struct eventmode_conf *em_conf)
 	return 0;
 }
 
+static void
+eh_display_operating_mode(struct eventmode_conf *em_conf)
+{
+	char sched_types[][32] = {
+		"RTE_SCHED_TYPE_ORDERED",
+		"RTE_SCHED_TYPE_ATOMIC",
+		"RTE_SCHED_TYPE_PARALLEL",
+	};
+	EH_LOG_INFO("Operating mode:");
+
+	EH_LOG_INFO("\tScheduling type: \t%s",
+		sched_types[em_conf->ext_params.sched_type]);
+
+	EH_LOG_INFO("");
+}
+
+static void
+eh_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",
+	};
+
+	EH_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]);
+		EH_LOG_INFO("%s", print_buf);
+	}
+	EH_LOG_INFO("");
+}
+
+static void
+eh_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 rx_adapter_connection_info *conn;
+	char print_buf[256] = { 0 };
+
+	EH_LOG_INFO("Rx adapters configured: %d", nb_rx_adapter);
+
+	for (i = 0; i < nb_rx_adapter; i++) {
+		adapter = &(em_conf->rx_adapter[i]);
+		EH_LOG_INFO(
+			"\tRx adaper 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);
+			EH_LOG_INFO("%s", print_buf);
+		}
+	}
+	EH_LOG_INFO("");
+}
+
+static void
+eh_display_tx_adapter_conf(struct eventmode_conf *em_conf)
+{
+	int i, j;
+	int nb_tx_adapter = em_conf->nb_tx_adapter;
+	struct tx_adapter_conf *adapter;
+	struct tx_adapter_connection_info *conn;
+	char print_buf[256] = { 0 };
+
+	EH_LOG_INFO("Tx adapters configured: %d", nb_tx_adapter);
+
+	for (i = 0; i < nb_tx_adapter; i++) {
+		adapter = &(em_conf->tx_adapter[i]);
+		sprintf(print_buf,
+			"\tTx adapter ID: %-2d\tConnections: %-2d\tEvent dev ID: %-2d",
+			adapter->adapter_id,
+			adapter->nb_connections,
+			adapter->eventdev_id);
+		if (adapter->tx_core_id == (uint32_t)-1)
+			sprintf(print_buf + strlen(print_buf),
+				"\tTx core: %-2s", "[INTERNAL PORT]");
+		else if (adapter->tx_core_id == RTE_MAX_LCORE)
+			sprintf(print_buf + strlen(print_buf),
+				"\tTx core: %-2s", "[NONE]");
+		else
+			sprintf(print_buf + strlen(print_buf),
+				"\tTx core: %-2d,\tInput event queue: %-2d",
+				adapter->tx_core_id, adapter->tx_ev_queue);
+
+		EH_LOG_INFO("%s", print_buf);
+
+		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_tx_qid == -1)
+				sprintf(print_buf + strlen(print_buf),
+					"\tEth tx queue: %-2s", "ALL");
+			else
+				sprintf(print_buf + strlen(print_buf),
+					"\tEth tx queue: %-2d",
+					conn->ethdev_tx_qid);
+			EH_LOG_INFO("%s", print_buf);
+		}
+	}
+	EH_LOG_INFO("");
+}
+
+static void
+eh_display_link_conf(struct eventmode_conf *em_conf)
+{
+	int i;
+	struct eh_event_link_info *link;
+	char print_buf[256] = { 0 };
+
+	EH_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);
+		EH_LOG_INFO("%s", print_buf);
+	}
+	EH_LOG_INFO("");
+}
+
+void
+eh_display_conf(struct eh_conf *mode_conf)
+{
+	struct eventmode_conf *em_conf;
+
+	if (mode_conf == NULL) {
+		EH_LOG_INFO("Invalid conf");
+		return;
+	}
+
+	if (mode_conf->mode != EH_PKT_TRANSFER_MODE_EVENT)
+		return;
+
+	if (mode_conf->mode_params == NULL) {
+		EH_LOG_INFO("Invalid mode params");
+		return;
+	}
+
+	/* Get eventmode conf */
+	em_conf = (struct eventmode_conf *)(mode_conf->mode_params);
+
+	/* Display user exposed operating modes */
+	eh_display_operating_mode(em_conf);
+
+	/* Display event device conf */
+	eh_display_event_dev_conf(em_conf);
+
+	/* Display Rx adapter conf */
+	eh_display_rx_adapter_conf(em_conf);
+
+	/* Display Tx adapter conf */
+	eh_display_tx_adapter_conf(em_conf);
+
+	/* Display event-lcore link */
+	eh_display_link_conf(em_conf);
+}
+
 int32_t
 eh_devs_init(struct eh_conf *mode_conf)
 {
@@ -900,6 +1104,9 @@ eh_devs_init(struct eh_conf *mode_conf)
 		return -EINVAL;
 	}
 
+	/* Display the current configuration */
+	eh_display_conf(mode_conf);
+
 	/* Stop eth devices before setting up adapter */
 	RTE_ETH_FOREACH_DEV(portid) {
 
diff --git a/examples/ipsec-secgw/event_helper.h b/examples/ipsec-secgw/event_helper.h
index 01e2aca..c7fdd8f 100644
--- a/examples/ipsec-secgw/event_helper.h
+++ b/examples/ipsec-secgw/event_helper.h
@@ -27,6 +27,11 @@ extern "C" {
 		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
 			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
 
+#define EH_LOG_INFO(...) \
+	RTE_LOG(INFO, EH, \
+		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
+			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
+
 /* Max event devices supported */
 #define EVENT_MODE_MAX_EVENT_DEVS RTE_EVENT_MAX_DEVS
 
@@ -228,6 +233,15 @@ eh_devs_uninit(struct eh_conf *mode_conf);
 uint8_t
 eh_get_tx_queue(struct eh_conf *mode_conf, uint8_t eventdev_id);
 
+/**
+ * Display event mode configuration
+ *
+ * @param mode_conf
+ *   Configuration of the mode in which app is doing packet handling
+ */
+void
+eh_display_conf(struct eh_conf *mode_conf);
+
 #ifdef __cplusplus
 }
 #endif
-- 
2.7.4


  parent reply	other threads:[~2019-10-09 15:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-09 15:10 [dpdk-dev] [RFC PATCH 00/13] add eventmode to ipsec-secgw Anoob Joseph
2019-10-09 15:10 ` [dpdk-dev] [RFC PATCH 01/13] examples/ipsec-secgw: add framework for eventmode helper Anoob Joseph
2019-10-09 15:10 ` [dpdk-dev] [RFC PATCH 02/13] examples/ipsec-secgw: add eventdev port-lcore link Anoob Joseph
2019-10-09 15:10 ` [dpdk-dev] [RFC PATCH 03/13] examples/ipsec-secgw: add Rx adapter support Anoob Joseph
2019-10-09 15:10 ` [dpdk-dev] [RFC PATCH 04/13] examples/ipsec-secgw: add Tx " Anoob Joseph
2019-10-09 15:10 ` Anoob Joseph [this message]
2019-10-09 15:10 ` [dpdk-dev] [RFC PATCH 06/13] examples/ipsec-secgw: add routines to launch workers Anoob Joseph
2019-10-09 15:10 ` [dpdk-dev] [RFC PATCH 07/13] examples/ipsec-secgw: add support for internal ports Anoob Joseph
2019-10-09 15:10 ` [dpdk-dev] [RFC PATCH 08/13] examples/ipsec-secgw: add eventmode to ipsec-secgw Anoob Joseph
2019-10-09 15:10 ` [dpdk-dev] [RFC PATCH 09/13] examples/ipsec-secgw: add app inbound worker Anoob Joseph
2019-10-09 15:10 ` [dpdk-dev] [RFC PATCH 10/13] examples/ipsec-secgw: add app processing code Anoob Joseph
2019-10-09 15:10 ` [dpdk-dev] [RFC PATCH 11/13] examples/ipsec-secgw: add driver outbound worker Anoob Joseph
2019-10-09 15:10 ` [dpdk-dev] [RFC PATCH 12/13] examples/ipsec-secgw: add app " Anoob Joseph
2019-10-09 15:10 ` [dpdk-dev] [RFC PATCH 13/13] examples/ipsec-secgw: add cmd line option for bufs Anoob Joseph
2019-10-16 13:02 ` [dpdk-dev] [RFC PATCH 00/13] add eventmode to ipsec-secgw Ananyev, Konstantin
2019-10-25  6:31   ` Anoob Joseph
2019-10-25  9:39     ` Ananyev, Konstantin
2019-10-28  5:44       ` Anoob Joseph

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=1570633816-4706-6-git-send-email-anoobj@marvell.com \
    --to=anoobj@marvell.com \
    --cc=akhil.goyal@nxp.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=lbartosik@marvell.com \
    --cc=pathreya@marvell.com \
    --cc=radu.nicolau@intel.com \
    --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).