From: Radu Nicolau Date: Mon, 1 Nov 2021 12:58:14 +0000 (+0000) Subject: examples/ipsec-secgw: add ethdev reset callback X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=fe105decc3229ec68df616cfdf4b48714284b9fa;p=dpdk.git examples/ipsec-secgw: add ethdev reset callback Applications should not quietly ignore an ethdev reset event. Register an event handler for ethdev reset callback RTE_ETH_EVENT_INTR_RESET that prints a message and quits the application. Signed-off-by: Declan Doherty Signed-off-by: Radu Nicolau Acked-by: Akhil Goyal --- diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index cb170e466a..cca2b0eb10 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -2551,6 +2551,17 @@ inline_ipsec_event_callback(uint16_t port_id, enum rte_eth_event_type type, return -1; } +static int +ethdev_reset_event_callback(uint16_t port_id, + enum rte_eth_event_type type, + void *param __rte_unused, void *ret_param __rte_unused) +{ + printf("Reset Event on port id %d type %d\n", port_id, type); + printf("Force quit application"); + force_quit = true; + return 0; +} + static uint16_t rx_callback(__rte_unused uint16_t port, __rte_unused uint16_t queue, struct rte_mbuf *pkt[], uint16_t nb_pkts, @@ -3317,6 +3328,9 @@ main(int32_t argc, char **argv) rte_strerror(-ret), portid); } + rte_eth_dev_callback_register(portid, RTE_ETH_EVENT_INTR_RESET, + ethdev_reset_event_callback, NULL); + rte_eth_dev_callback_register(portid, RTE_ETH_EVENT_IPSEC, inline_ipsec_event_callback, NULL); }