From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id D7C77A0C4C;
	Thu, 14 Oct 2021 11:53:54 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id D3F9E4123E;
	Thu, 14 Oct 2021 11:53:39 +0200 (CEST)
Received: from mga14.intel.com (mga14.intel.com [192.55.52.115])
 by mails.dpdk.org (Postfix) with ESMTP id C452841220
 for <dev@dpdk.org>; Thu, 14 Oct 2021 11:53:34 +0200 (CEST)
X-IronPort-AV: E=McAfee;i="6200,9189,10136"; a="227927763"
X-IronPort-AV: E=Sophos;i="5.85,372,1624345200"; d="scan'208";a="227927763"
Received: from orsmga008.jf.intel.com ([10.7.209.65])
 by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 14 Oct 2021 02:53:23 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.85,372,1624345200"; d="scan'208";a="491882238"
Received: from silpixa00401122.ir.intel.com ([10.55.128.10])
 by orsmga008.jf.intel.com with ESMTP; 14 Oct 2021 02:53:22 -0700
From: Kevin Laatz <kevin.laatz@intel.com>
To: dev@dpdk.org
Cc: bruce.richardson@intel.com, fengchengwen@huawei.com, conor.walsh@intel.com,
 Kevin Laatz <kevin.laatz@intel.com>
Date: Thu, 14 Oct 2021 09:53:08 +0000
Message-Id: <20211014095311.1311617-6-kevin.laatz@intel.com>
X-Mailer: git-send-email 2.30.2
In-Reply-To: <20211014095311.1311617-1-kevin.laatz@intel.com>
References: <20210910172737.2561156-1-kevin.laatz@intel.com>
 <20211014095311.1311617-1-kevin.laatz@intel.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH v4 5/8] examples/ioat: add signal-triggered
 device dumps
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

Enable dumping device info via the signal handler. With this change, when a
SIGUSR1 is issued, the application will print a dump of all devices being
used by the application.

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
---
 examples/ioat/ioatfwd.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/examples/ioat/ioatfwd.c b/examples/ioat/ioatfwd.c
index 8c4920b798..8bb69c1c14 100644
--- a/examples/ioat/ioatfwd.c
+++ b/examples/ioat/ioatfwd.c
@@ -1007,6 +1007,20 @@ port_init(uint16_t portid, struct rte_mempool *mbuf_pool, uint16_t nb_queues)
 	cfg.ports[cfg.nb_ports++].nb_queues = nb_queues;
 }
 
+/* Get a device dump for each device being used by the application */
+static void
+rawdev_dump(void)
+{
+	uint32_t i, j;
+
+	if (copy_mode != COPY_MODE_IOAT_NUM)
+		return;
+
+	for (i = 0; i < cfg.nb_ports; i++)
+		for (j = 0; j < cfg.ports[i].nb_queues; j++)
+			rte_rawdev_dump(cfg.ports[i].ioat_ids[j], stdout);
+}
+
 static void
 signal_handler(int signum)
 {
@@ -1014,6 +1028,8 @@ signal_handler(int signum)
 		printf("\n\nSignal %d received, preparing to exit...\n",
 			signum);
 		force_quit = true;
+	} else if (signum == SIGUSR1) {
+		rawdev_dump();
 	}
 }
 
@@ -1037,6 +1053,7 @@ main(int argc, char **argv)
 	force_quit = false;
 	signal(SIGINT, signal_handler);
 	signal(SIGTERM, signal_handler);
+	signal(SIGUSR1, signal_handler);
 
 	nb_ports = rte_eth_dev_count_avail();
 	if (nb_ports == 0)
-- 
2.30.2