summaryrefslogtreecommitdiff
path: root/examples/l3fwd-power/main.c
diff options
context:
space:
mode:
authorJianfeng Tan <jianfeng.tan@intel.com>2017-01-17 07:10:30 +0000
committerYuanhan Liu <yuanhan.liu@linux.intel.com>2017-01-17 09:27:16 +0100
commite2a6f1246e273fb63a829badf0916029611a98bf (patch)
treef71f8cb4b0c5326b74b2caae351596d1e70d26c9 /examples/l3fwd-power/main.c
parent82bea46616267730ec5201645123f14a83f251a6 (diff)
downloaddpdk-e2a6f1246e273fb63a829badf0916029611a98bf.zip
dpdk-e2a6f1246e273fb63a829badf0916029611a98bf.tar.gz
dpdk-e2a6f1246e273fb63a829badf0916029611a98bf.tar.xz
examples/l3fwd-power: fix stop and close on signal
As it gets killed, in SIGINT signal handler, device is not stopped and closed. In virtio's case, vector assignment in the KVM is not deassigned. This patch will invoke dev_stop() and dev_close() in signal handler. Fixes: d7937e2e3d12 ("power: initial import") Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com> Tested-by: Lei Yao <lei.a.yao@intel.com>
Diffstat (limited to 'examples/l3fwd-power/main.c')
-rw-r--r--examples/l3fwd-power/main.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index e741434..15b47c7 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -379,6 +379,7 @@ static void
signal_exit_now(int sigtype)
{
unsigned lcore_id;
+ unsigned int portid, nb_ports;
int ret;
if (sigtype == SIGINT) {
@@ -393,6 +394,15 @@ signal_exit_now(int sigtype)
"library de-initialization failed on "
"core%u\n", lcore_id);
}
+
+ nb_ports = rte_eth_dev_count();
+ for (portid = 0; portid < nb_ports; portid++) {
+ if ((enabled_port_mask & (1 << portid)) == 0)
+ continue;
+
+ rte_eth_dev_stop(portid);
+ rte_eth_dev_close(portid);
+ }
}
rte_exit(EXIT_SUCCESS, "User forced exit\n");