patches for DPDK stable branches
 help / color / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Rasesh Mody <rmody@marvell.com>
Cc: dev@dpdk.org, Ferruh Yigit <ferruh.yigit@intel.com>,
	stable@dpdk.org, Xi Zhang <xix.zhang@intel.com>
Subject: [dpdk-stable] [PATCH] examples/kni: fix crash during MTU set
Date: Thu, 21 May 2020 16:10:42 +0100
Message-ID: <20200521151042.3730374-1-ferruh.yigit@intel.com> (raw)

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 <ferruh.yigit@intel.com>
---
Cc: Rasesh Mody <rmody@marvell.com>
Cc: Xi Zhang <xix.zhang@intel.com>
---
 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


             reply index

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-21 15:10 Ferruh Yigit [this message]
2020-05-21 15:37 ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
2020-05-21 15:46   ` Ferruh Yigit
2020-05-21 20:29     ` Thomas Monjalon
2020-05-21 17:32 ` [dpdk-stable] [EXT] " Rasesh Mody
2020-05-24 15:50   ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
2020-05-22  2:17 ` [dpdk-stable] " Zhang, XiX

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200521151042.3730374-1-ferruh.yigit@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.org \
    --cc=rmody@marvell.com \
    --cc=stable@dpdk.org \
    --cc=xix.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

patches for DPDK stable branches

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/ public-inbox