From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f196.google.com (mail-wr0-f196.google.com [209.85.128.196]) by dpdk.org (Postfix) with ESMTP id 780CC1B873 for ; Tue, 15 May 2018 15:48:44 +0200 (CEST) Received: by mail-wr0-f196.google.com with SMTP id 94-v6so224942wrf.5 for ; Tue, 15 May 2018 06:48:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5CUnhMC1MEvrA0S6XIEIyg4Q+sn7tn1+KO5+5ulQUVY=; b=FLG+h0eVfjuX7VmxAP8l0BljZuCwBeGQlyBU7nwTdJeoC3LG3UYoilOupeT6AzNC43 rs06LRNZz0DKahxveDGeQALesDftuCnL+bBKwlpiGD2DNVkp5F1i1E/RQJBhYe+mGmFb DuI05gCu4yBptMjZz4Zq6Qwh5X0zY26Ol36Ip8BDf6Po4HOcmcgfzFk/SO7QEOsq07dB NXyc5dR6xSAwtqntIAnchc+O0yuO9Of2qWafeb1Nv0aLiDjLi41JyThIvWDZb/ozo/Fc LWDxqeoDBSXFOU3i6sQy35jidC3HZduFBPYLAwkLvLVU0F1HMSo2sUecBt45LPE5Fgl4 P/qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5CUnhMC1MEvrA0S6XIEIyg4Q+sn7tn1+KO5+5ulQUVY=; b=E40Lt7mVDe4x7duYo9Jg5wFy8qkYVhNnq9wcTcAmAwRb03yLTqbZHbroIPcIYJAy9j mTpgD6Gd1YhqnoW1y7Y4M9Y921yx7OKV+BpKnHX6fR/14N4T1T0iUnbDYVkr6US/QnEi ghXOvf6LAdU5NBQhlJ75Cl7a9WBKs64R1Fus+jzOfSC9oLsMgYs+/rXVxBgjoYaC/zYi iSnU3amPwhLNlEIFJuJI6LvnoWnnZ7CBFH/Yv5GV9tdTm2ZTcECKkB2W4NM7awanSd3N wXvndEr0rbeRmz41mxDRlgvlZvkPAdlq/aFuKkmtXNhNE6LutOHbG+t992w06Yb8murO AKAg== X-Gm-Message-State: ALKqPweDRtcET0qE+4ekKBz6IFnwP0Oi+qsp8jZFZDEr90NsviP47YVz /4/WYzyg3OTpQs3OuG9/ROs= X-Google-Smtp-Source: AB8JxZobc76LdjIKYhAgnrqoIxYbGnvqTWvTSUuXWxChlTD7gqyyetnPGEnyZXHYzYiaDYyEh8fJ0A== X-Received: by 2002:adf:83c6:: with SMTP id 64-v6mr11280585wre.270.1526392124220; Tue, 15 May 2018 06:48:44 -0700 (PDT) Received: from localhost (slip139-92-244-193.lon.uk.prserv.net. [139.92.244.193]) by smtp.gmail.com with ESMTPSA id u20-v6sm134896wru.33.2018.05.15.06.48.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 May 2018 06:48:43 -0700 (PDT) From: luca.boccassi@gmail.com To: Matan Azrad Cc: dpdk stable Date: Tue, 15 May 2018 14:46:48 +0100 Message-Id: <20180515134731.9337-37-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180515134731.9337-1-luca.boccassi@gmail.com> References: <20180503110612.12146-2-luca.boccassi@gmail.com> <20180515134731.9337-1-luca.boccassi@gmail.com> Subject: [dpdk-stable] patch 'app/testpmd: fix asynchronic port removal' has been queued to stable release 18.02.2 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 May 2018 13:48:44 -0000 Hi, FYI, your patch has been queued to stable release 18.02.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/16/18. So please shout if anyone has objections. Thanks. Luca Boccassi --- >>From 157baa268d911d22b9496e77e0b165b8fca21396 Mon Sep 17 00:00:00 2001 From: Matan Azrad Date: Thu, 3 May 2018 10:31:48 +0000 Subject: [PATCH] app/testpmd: fix asynchronic port removal [ upstream commit 3b97888ab2a8405bcbe198abdcc8ac98ee0f0e96 ] When a removable device is plugged-out, a RMV interrupt is invoked and the application can catch the event in order to stop the device management. The Testpmd wrong behavior in this case is to detach the removed device using the EAL detach API. The EAL API does not invalidate the ethdev port and the port keeps appearing as valid from the ethdev point of view. Thus, the next operations for the ethtev port X may trigger an invalid rte_device access. For example, calling "show port info X" may cause segfault. Moreover, the removed port is not removed from the Testpmd data-path structures. Therefore, the invalid device may still be used by the Testpmd data-path. Call the Testpmd detach_port() function which uses the ethdev detach API, and prepare the Testpmd forward ports database for a new forwarding session without the detached port. Fixes: 284c908cc588 ("app/testpmd: request device removal interrupt") Signed-off-by: Matan Azrad --- app/test-pmd/testpmd.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 3c92e899b..9ab44813d 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -2027,21 +2027,23 @@ check_all_ports_link_status(uint32_t port_mask) static void rmv_event_callback(void *arg) { + int need_to_start = 0; int org_no_link_check = no_link_check; - struct rte_eth_dev *dev; portid_t port_id = (intptr_t)arg; RTE_ETH_VALID_PORTID_OR_RET(port_id); - dev = &rte_eth_devices[port_id]; + if (!test_done && port_is_forwarding(port_id)) { + need_to_start = 1; + stop_packet_forwarding(); + } no_link_check = 1; stop_port(port_id); no_link_check = org_no_link_check; close_port(port_id); - printf("removing device %s\n", dev->device->name); - if (rte_eal_dev_detach(dev->device)) - TESTPMD_LOG(ERR, "Failed to detach device %s\n", - dev->device->name); + detach_port(port_id); + if (need_to_start) + start_packet_forwarding(0); } /* This function is used by the interrupt thread */ -- 2.14.2