From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 66E79A00C5; Thu, 21 May 2020 17:10:50 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DA8301D6E5; Thu, 21 May 2020 17:10:49 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id AA5CE1D678; Thu, 21 May 2020 17:10:47 +0200 (CEST) IronPort-SDR: dNpX4olt5Buu4NtfZFiNDnRSeSuIvWvV7LUKyLIu8Lx19Nb3JxvJX+SCz7vNMQetlgpld4FCLr wKvSGiQhAUBQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2020 08:10:46 -0700 IronPort-SDR: IAeN7bBo9QchoQXReC9cznPIkIkMZW4b5a+GWUFrbwOhXzg1XejBte8jzRWmpJe7bMfq19InIm Z6u2cEP8o0Kg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,418,1583222400"; d="scan'208";a="309062688" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.180]) by FMSMGA003.fm.intel.com with ESMTP; 21 May 2020 08:10:44 -0700 From: Ferruh Yigit To: Rasesh Mody Cc: dev@dpdk.org, Ferruh Yigit , stable@dpdk.org, Xi Zhang Date: Thu, 21 May 2020 16:10:42 +0100 Message-Id: <20200521151042.3730374-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] examples/kni: fix crash during MTU set X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- Cc: Rasesh Mody Cc: Xi Zhang --- examples/kni/main.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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) -- 2.25.4