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 60020A2EFC for ; Mon, 14 Oct 2019 20:24:22 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CC3D91D40E; Mon, 14 Oct 2019 20:23:35 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 7061B1D155 for ; Mon, 14 Oct 2019 20:23:32 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x9EIKeCD007326; Mon, 14 Oct 2019 11:23:31 -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=f2NTWSvOWrm+kpddKH9FzS6DLRyncZ4255Ldmjz8Egg=; b=d1WhQONXYRmrCw3wi4YZhsjWxNARx9H2wr3Xim7uTa8GBni/jQfonj6fmOMh7XfNEBMi v/Y81mlB9/Lrm/YZmiuxRytcl+hiE2UJ5YlYfPQLXCZBPCa/0NVWCoJUapBkTcoDYQl/ 00Z/gD0rlqm04gndi0z+4NwWlh0scYjR0xjnnOkguIEdZ2cB4YbCqMNUu6PBHRNVZrsQ 0GLzS5/ov88EE6GjyITugLUWQJNkby1di2ns6VWzbqQIq8TDzMu1ySmL1AHht91o1lS8 ZOMJXOnBwnl2E/5ns8W7QKseTQTDHUbbHd7ndn7z1sBYeTBH81FwGF72OPlokq/eyLkc 8Q== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 2vkc6r7k4s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 14 Oct 2019 11:23:31 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 14 Oct 2019 11:23:30 -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; Mon, 14 Oct 2019 11:23:30 -0700 Received: from BG-LT7430.marvell.com (pe-lt7585.marvell.com [10.28.17.46]) by maili.marvell.com (Postfix) with ESMTP id 000AB3F7043; Mon, 14 Oct 2019 11:23:26 -0700 (PDT) From: To: , , , Marko Kovacevic , "Ori Kam" , Radu Nicolau , Akhil Goyal , Tomasz Kantecki , "Sunil Kumar Kori" , Pavan Nikhilesh CC: Date: Mon, 14 Oct 2019 23:52:46 +0530 Message-ID: <20191014182247.961-10-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191014182247.961-1-pbhagavatula@marvell.com> References: <20191002205754.11746-1-pbhagavatula@marvell.com> <20191014182247.961-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-10-14_09:2019-10-11,2019-10-14 signatures=0 Subject: [dpdk-dev] [PATCH v6 09/10] examples/l2fwd-event: add graceful teardown 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/l2fwd-event/main.c | 50 +++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/examples/l2fwd-event/main.c b/examples/l2fwd-event/main.c index c11b057aa..6d4215890 100644 --- a/examples/l2fwd-event/main.c +++ b/examples/l2fwd-event/main.c @@ -304,7 +304,7 @@ main(int argc, char **argv) uint16_t port_id, last_port; uint32_t nb_mbufs; uint16_t nb_ports; - int ret; + int i, ret; /* init EAL */ ret = rte_eal_init(argc, argv); @@ -409,16 +409,46 @@ main(int argc, char **argv) /* launch per-lcore init on every lcore */ rte_eal_mp_remote_launch(l2fwd_launch_one_lcore, rsrc, CALL_MASTER); - rte_eal_mp_wait_lcore(); + if (rsrc->event_mode) { + struct l2fwd_event_resources *evt_rsrc = + rsrc->evt_rsrc; + for (i = 0; i < evt_rsrc->rx_adptr.nb_rx_adptr; i++) + rte_event_eth_rx_adapter_stop( + evt_rsrc->rx_adptr.rx_adptr[i]); + for (i = 0; i < evt_rsrc->tx_adptr.nb_tx_adptr; i++) + rte_event_eth_tx_adapter_stop( + evt_rsrc->tx_adptr.tx_adptr[i]); - RTE_ETH_FOREACH_DEV(port_id) { - if ((rsrc->enabled_port_mask & - (1 << port_id)) == 0) - continue; - printf("Closing port %d...", port_id); - rte_eth_dev_stop(port_id); - rte_eth_dev_close(port_id); - printf(" Done\n"); + RTE_ETH_FOREACH_DEV(port_id) { + if ((rsrc->enabled_port_mask & + (1 << port_id)) == 0) + continue; + rte_eth_dev_stop(port_id); + } + + rte_eal_mp_wait_lcore(); + RTE_ETH_FOREACH_DEV(port_id) { + if ((rsrc->enabled_port_mask & + (1 << port_id)) == 0) + continue; + rte_eth_dev_close(port_id); + } + + rte_event_dev_stop(evt_rsrc->event_d_id); + rte_event_dev_close(evt_rsrc->event_d_id); + + } else { + rte_eal_mp_wait_lcore(); + + RTE_ETH_FOREACH_DEV(port_id) { + if ((rsrc->enabled_port_mask & + (1 << port_id)) == 0) + continue; + printf("Closing port %d...", port_id); + rte_eth_dev_stop(port_id); + rte_eth_dev_close(port_id); + printf(" Done\n"); + } } printf("Bye...\n"); -- 2.17.1