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 A5883A2EDB for ; Wed, 2 Oct 2019 22:59:21 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D43621BF80; Wed, 2 Oct 2019 22:58:37 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 7D3A01BF99 for ; Wed, 2 Oct 2019 22:58:36 +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 x92KsVCc015241; Wed, 2 Oct 2019 13:58:36 -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=3olWUzuvtwlsd0w9VVRWrm10xFSLiMXLBjd41kJaOl4=; b=cCKwJ5TU/17cKlWEa/GhW7Uj9gs8lZd+tUHSUaC0kG9WX/W8CCBhZJZ3CCdSKgUA09F7 LacFZbEizB/CrHE+olbKl3F7TPEYlgwkOkbwUkxIoipDa29QMCcWxfsdsoTDfMd7h+m8 jfYfebtZxyVH5rN1tyV0vQ1CMPowRdETnK3MSJ2H5N5f2HwVD2gqD/9+ZtHdBlhdEixm vRnnwPv9UbBAkLQ/MPOb6VuyMvdcRgWFN/ionOeZ9XHpK35BBilTurXbcZf9XghpNH/s C6F+CqQ8ARvh6M7QCBVkk4PwIsamLpuzKn1/5URoeRj0t4EY3YpY/18YeaN0fZOHwOVM hA== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 2vd0ya0kts-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 02 Oct 2019 13:58:35 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 2 Oct 2019 13:58:34 -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; Wed, 2 Oct 2019 13:58:34 -0700 Received: from BG-LT7430.marvell.com (unknown [10.28.17.68]) by maili.marvell.com (Postfix) with ESMTP id 6283D3F703F; Wed, 2 Oct 2019 13:58:31 -0700 (PDT) From: To: , , , Marko Kovacevic , Ori Kam , Radu Nicolau , Tomasz Kantecki , Sunil Kumar Kori , "Pavan Nikhilesh" CC: Date: Thu, 3 Oct 2019 02:27:53 +0530 Message-ID: <20191002205754.11746-10-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191002205754.11746-1-pbhagavatula@marvell.com> References: <20190924094209.3827-1-pbhagavatula@marvell.com> <20191002205754.11746-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-02_08:2019-10-01,2019-10-02 signatures=0 Subject: [dpdk-dev] [PATCH v5 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 958a6e0b7..f075b3f10 100644 --- a/examples/l2fwd-event/main.c +++ b/examples/l2fwd-event/main.c @@ -302,7 +302,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); @@ -410,16 +410,46 @@ main(int argc, char **argv) /* launch per-lcore init on every lcore */ rte_eal_mp_remote_launch(l2fwd_launch_one_lcore, l2fwd_rsrc, CALL_MASTER); - rte_eal_mp_wait_lcore(); + if (l2fwd_rsrc->event_mode) { + struct l2fwd_event_resources *event_rsrc = + l2fwd_rsrc->event_rsrc; + for (i = 0; i < event_rsrc->rx_adptr.nb_rx_adptr; i++) + rte_event_eth_rx_adapter_stop( + event_rsrc->rx_adptr.rx_adptr[i]); + for (i = 0; i < event_rsrc->tx_adptr.nb_tx_adptr; i++) + rte_event_eth_tx_adapter_stop( + event_rsrc->tx_adptr.tx_adptr[i]); - RTE_ETH_FOREACH_DEV(port_id) { - if ((l2fwd_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 ((l2fwd_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 ((l2fwd_rsrc->enabled_port_mask & + (1 << port_id)) == 0) + continue; + rte_eth_dev_close(port_id); + } + + rte_event_dev_stop(event_rsrc->event_d_id); + rte_event_dev_close(event_rsrc->event_d_id); + + } else { + rte_eal_mp_wait_lcore(); + + RTE_ETH_FOREACH_DEV(port_id) { + if ((l2fwd_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