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 5C619A0613 for ; Thu, 26 Sep 2019 12:07:22 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AA0D31BFB4; Thu, 26 Sep 2019 12:06:45 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id CE4221BFAB for ; Thu, 26 Sep 2019 12:06:42 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x8QA4gPh032601; Thu, 26 Sep 2019 03:06:42 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=5IGMOTkw+GFreDBssguXk0sm+1M8SrancnXRuY0a0Eg=; b=jtOxfJQl/6LkIDOg5Tj5Kxm7QuOKS0SrC5LObqStLxlYI4t5Or2fl/Gvv0KMbO9itfvi e/nXPdygPntWOqgDUMtbBAgJrtvc7Mqbjh71EMId5kDbR+KvHOnllK++No1O1pHJnL8R ONb+YYuT9zw2Lhyhs8q4nURULjQ5eW28BMNA9SUD3W17Oew1Lzlm73AudxkWe2cZ5Gif JeyoT9gmB1Q3yyk79kd5prozZtdQwY9Idya9lhiBl0q9g0ZVRVUrwgc8lc45cu32gpBl 4DWcizvpwILdK6CGnHcb0EFmtRAGbFWKrAc2xRr77pbq/oP810diEfnVmsqD5WsbXEfz uQ== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2v8u5dr1c7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 26 Sep 2019 03:06:42 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 26 Sep 2019 03:06:40 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 26 Sep 2019 03:06:40 -0700 Received: from BG-LT7430.marvell.com (unknown [10.28.17.15]) by maili.marvell.com (Postfix) with ESMTP id 91C0A3F703F; Thu, 26 Sep 2019 03:06:37 -0700 (PDT) From: To: , , Marko Kovacevic , Ori Kam , Bruce Richardson , Radu Nicolau , "Tomasz Kantecki" CC: , Pavan Nikhilesh Date: Thu, 26 Sep 2019 15:35:57 +0530 Message-ID: <20190926100558.24348-11-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190926100558.24348-1-pbhagavatula@marvell.com> References: <20190926100558.24348-1-pbhagavatula@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,1.0.8 definitions=2019-09-26_04:2019-09-25,2019-09-26 signatures=0 Subject: [dpdk-dev] [PATCH 10/11] examples/l3fwd: add graceful teardown for eventdevice 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" From: Pavan Nikhilesh Add graceful teardown that addresses both event mode and poll mode. Signed-off-by: Pavan Nikhilesh --- examples/l3fwd/main.c | 49 ++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index e31afe045..d7b7fc287 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -911,7 +911,7 @@ main(int argc, char **argv) struct lcore_conf *qconf; struct rte_eth_dev_info dev_info; struct rte_eth_txconf *txconf; - int ret; + int i, ret; unsigned nb_ports; uint16_t queueid, portid; unsigned lcore_id; @@ -1166,27 +1166,46 @@ main(int argc, char **argv) } } - check_all_ports_link_status(enabled_port_mask); ret = 0; /* launch per-lcore init on every lcore */ rte_eal_mp_remote_launch(l3fwd_lkp.main_loop, NULL, CALL_MASTER); - RTE_LCORE_FOREACH_SLAVE(lcore_id) { - if (rte_eal_wait_lcore(lcore_id) < 0) { - ret = -1; - break; + if (evdev_rsrc->enabled) { + for (i = 0; i < evdev_rsrc->rx_adptr.nb_rx_adptr; i++) + rte_event_eth_rx_adapter_stop( + evdev_rsrc->rx_adptr.rx_adptr[i]); + for (i = 0; i < evdev_rsrc->tx_adptr.nb_tx_adptr; i++) + rte_event_eth_tx_adapter_stop( + evdev_rsrc->tx_adptr.tx_adptr[i]); + + RTE_ETH_FOREACH_DEV(portid) { + if ((enabled_port_mask & (1 << portid)) == 0) + continue; + rte_eth_dev_stop(portid); } - } - /* stop ports */ - RTE_ETH_FOREACH_DEV(portid) { - if ((enabled_port_mask & (1 << portid)) == 0) - continue; - printf("Closing port %d...", portid); - rte_eth_dev_stop(portid); - rte_eth_dev_close(portid); - printf(" Done\n"); + rte_eal_mp_wait_lcore(); + RTE_ETH_FOREACH_DEV(portid) { + if ((enabled_port_mask & (1 << portid)) == 0) + continue; + rte_eth_dev_close(portid); + } + + rte_event_dev_stop(evdev_rsrc->event_d_id); + rte_event_dev_close(evdev_rsrc->event_d_id); + + } else { + rte_eal_mp_wait_lcore(); + + RTE_ETH_FOREACH_DEV(portid) { + if ((enabled_port_mask & (1 << portid)) == 0) + continue; + printf("Closing port %d...", portid); + rte_eth_dev_stop(portid); + rte_eth_dev_close(portid); + printf(" Done\n"); + } } printf("Bye...\n"); -- 2.17.1