[v4,5/8] examples/ioat: add signal-triggered device dumps

Message ID 20211014095311.1311617-6-kevin.laatz@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series port ioatfwd app to dmadev |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Kevin Laatz Oct. 14, 2021, 9:53 a.m. UTC
  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(+)
  

Patch

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)