[dpdk-dev] [PATCH 1/3] app/test-pmd: Handle SIGINT and SIGTERM in testpmd
Wang, Zhihong
zhihong.wang at intel.com
Thu Dec 24 11:18:44 CET 2015
> > +/* When we receive a INT signal, close all ports */ static void
> > +sigint_handler(__rte_unused int signum) {
> > + unsigned portid;
> > +
> > + printf("Preparing to exit...\n");
>
> Better to notice user "Signal xxx received, reparing to exit... "
Can do that.
>
> > + FOREACH_PORT(portid, ports) {
> > + if (port_id_is_invalid(portid, ENABLED_WARN))
> > + continue;
> > + printf("Stopping port %d...", portid);
> > + rte_eth_dev_stop(portid);
> > + rte_eth_dev_close(portid);
> > + printf(" Done\n");
> > + }
> > + printf("Bye...\n");
>
> Here why don't call pmd_test_exit()? Any issue with that func?
Yes should just call this one :)
>
> Thanks,
> Michael
> > + exit(0);
> > +}
> > +
> > int
> > main(int argc, char** argv)
> > {
> > int diag;
> > uint8_t port_id;
> >
> > + signal(SIGINT, sigint_handler);
> > + signal(SIGTERM, sigint_handler);
> > +
> > diag = rte_eal_init(argc, argv);
> > if (diag < 0)
> > rte_panic("Cannot init EAL\n");
More information about the dev
mailing list