From: Ferruh Yigit Date: Thu, 21 May 2020 15:10:42 +0000 (+0100) Subject: examples/kni: fix crash during MTU set X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=36f9eba4710b521b95d72f0e65e85f38c1cff9b5;p=dpdk.git examples/kni: fix crash during MTU set During MTU set (kni_change_mtu) sample application setup queues, which can free and re-allocate queues. Meanwhile sample application keeps continues in Rx/Tx burst calls in different threads, which may cause crash during queue setup. Pausing application Rx/Tx calls before MTU set and starts it back afterwards. Bugzilla ID: 482 Fixes: a26b116749a3 ("examples/kni: fix MTU change to setup Tx queue") Cc: stable@dpdk.org Signed-off-by: Ferruh Yigit Acked-by: Rasesh Mody Tested-by: Xi Zhang --- diff --git a/examples/kni/main.c b/examples/kni/main.c index 7a927a50c0..80dd0353e7 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -768,9 +768,8 @@ monitor_all_ports_link_status(void *arg) return NULL; } -/* Callback for request of changing MTU */ static int -kni_change_mtu(uint16_t port_id, unsigned int new_mtu) +kni_change_mtu_(uint16_t port_id, unsigned int new_mtu) { int ret; uint16_t nb_rxd = NB_RXD; @@ -851,6 +850,19 @@ kni_change_mtu(uint16_t port_id, unsigned int new_mtu) return 0; } +/* Callback for request of changing MTU */ +static int +kni_change_mtu(uint16_t port_id, unsigned int new_mtu) +{ + int ret; + + rte_atomic32_inc(&kni_pause); + ret = kni_change_mtu_(port_id, new_mtu); + rte_atomic32_dec(&kni_pause); + + return ret; +} + /* Callback for request of configuring network interface up/down */ static int kni_config_network_interface(uint16_t port_id, uint8_t if_up)