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 306A2A04F1; Mon, 6 Jan 2020 05:50:25 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 952721D5A0; Mon, 6 Jan 2020 05:50:24 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id F1F2A1D17B for ; Mon, 6 Jan 2020 05:50:22 +0100 (CET) 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 0064hc4p023705; Sun, 5 Jan 2020 20:50:22 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=iNzvrcm6HXCiT7mTpk0HExxifG2GtPzlky8kFhYuVr4=; b=RrcmMyOGlOAQddtpFDT/+55lVu5aHGfDFRk+fGOu1LQRDYJg2u1mv2vXoMVT4zMuEMsI pZK4nmB8ESlWm7+oVubwqMjwuIAAAQzrXzwbfIVcZnWxXGUtf2oCTSrEr0YvsUV+XL1J v/q+wedRbQ+cjDoFgHksdn8KqtDcpgcnRE51VBb8/RrYLx1AMl2OP8PBERu3xfVs1qPc kBjR7EREVOaEqMng79jMgCMoChrHwjVi+8s8JV1MeVfAeGS6lejG3l1yD7x7ZMixZ2Qh XbNeOfZnjcNZ2WErIN6WzcO2Y4L680eS2ESh2Mr3VE2DAHG65wtk036lSJdPvy8W4uEf +g== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2xarxv4jns-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 05 Jan 2020 20:50:20 -0800 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 5 Jan 2020 20:50:17 -0800 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.176) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Sun, 5 Jan 2020 20:50:17 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KqwY4dqJs2oTj/uQPgGUi3a0IVG4cfyzW+cAljugT+2WSytIQPgucH6HwyyttDJGFBwtF2jD5gRrkRlmcC4QEOxHiKyMWpMg4B/HBKdeFia0SiLtfAw0h1MvCuXmhxfP/fCGQ0OPkImcdAnhHiCAJTrc/I8TJ4CGP3sZuqSy0ZMMRYe6rRj3Rh3UHSY+BbCeb6ZhkZnUvXaGeGGCd9/E39PgFdsCVvvO09r9MQ9UQ3c9cqiSASMZVZaML1dNPZ2a0n+aKSm122YutmVoVgCrnJ0pf59Yx8Cuv53JYGGCJnKQK1Nw0Mnf++kt/EyJlw1ZC47N8r7VnpAoNpUJ9ptkeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iNzvrcm6HXCiT7mTpk0HExxifG2GtPzlky8kFhYuVr4=; b=JQIn5mF+VNqNrdUUzetJynlcP1AswSUpkZCaKoOT29NqFiVqFPy8Oq3CP1LlXygmJepYfgbmaLd6W50zSdeU3ycqE7RKP6mQ9cxPr47bCpbHvVweGf5t3JE59mFtxptr+CLV17gR5mwzlFlnsweQ7cvruO4FoHoIt1fA3pTBHBN6xPJzesufZk5kWPPYGgwF2o2ts0/QqaZ9LhvJX0TiC+tdaL7F3URpgL/M8p5qU1Rs9j5ahUIow1FtjE7xtmzgUocmaEU/o+XrGlUSBp9+hlysRNlgg54tm2fOFEtXjBjddOBnXUsaVigVvEfB2Kfkeyk0lJfz3bODGpWXwZTJQw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iNzvrcm6HXCiT7mTpk0HExxifG2GtPzlky8kFhYuVr4=; b=HRCYneno9w1DKIDQa+WuO+FmGTH6k+fjJs6V/CHhmQp7ehzdAQSksIvsh4gkbTiXZHHFreLBksgkfrgYepyFXHOs+0tgL2lbgl1oJtIY1+5IsCMxXghRxpeusDyEDwYU5cGiKmRvULCFgO0cSWvBb8INhhlkO4P4s9O73Xcl/sU= Received: from CY4PR1801MB1863.namprd18.prod.outlook.com (10.171.255.160) by CY4PR1801MB1816.namprd18.prod.outlook.com (10.165.89.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.15; Mon, 6 Jan 2020 04:50:16 +0000 Received: from CY4PR1801MB1863.namprd18.prod.outlook.com ([fe80::edb0:c18d:7455:f60b]) by CY4PR1801MB1863.namprd18.prod.outlook.com ([fe80::edb0:c18d:7455:f60b%4]) with mapi id 15.20.2602.015; Mon, 6 Jan 2020 04:50:16 +0000 From: Pavan Nikhilesh Bhagavatula To: "Ananyev, Konstantin" , "Jerin Jacob Kollanukkaran" , "Kovacevic, Marko" , Ori Kam , "Richardson, Bruce" , "Nicolau, Radu" , Akhil Goyal , "Kantecki, Tomasz" , Sunil Kumar Kori CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2 10/11] examples/l3fwd: add graceful teardown for eventdevice Thread-Index: AQHVwj0oOcla0FnPekODMp/kjYSNRqfdFF4Q Date: Mon, 6 Jan 2020 04:50:16 +0000 Message-ID: References: <20191204144345.5736-1-pbhagavatula@marvell.com> <20191204144345.5736-11-pbhagavatula@marvell.com> In-Reply-To: Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [14.140.231.66] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 831878c6-6462-4a74-d02a-08d79263eca0 x-ms-traffictypediagnostic: CY4PR1801MB1816: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:206; x-forefront-prvs: 0274272F87 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(346002)(136003)(39850400004)(366004)(376002)(396003)(189003)(199004)(9686003)(55016002)(316002)(7696005)(86362001)(5660300002)(6636002)(2906002)(33656002)(110136005)(66946007)(8936002)(81166006)(55236004)(26005)(81156014)(52536014)(76116006)(478600001)(71200400001)(66556008)(6506007)(4326008)(66446008)(64756008)(66476007)(186003)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR1801MB1816; H:CY4PR1801MB1863.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 1Kj+nm6JWoU2fUE4PdYldATJiF5EX5+Me7FOAi5038plAq6OG+33Jja83U6DvbBDUh/DfM/o4qC5LgCdBZo7+OFtf0r/yeEDbkAj7p8AEakA48xoZ6jaEzgqXRnqkvLfwmyS3bbhbTLQkLGFmiEGHEfMAoqYZnaGJeiVu6L2EGRh0FhKdVNYcIGdbQ6q1LKOwxNnOt0eJTE7JzhfksvEHOsVB9mLYvbkVW4Zp2M/q2pBlQNuAS2cLf33CPWneoPKXyyGUG5qwj7p6IuUsAtk/GjmLtnBYFU14xoLEqeusPvFT/Aow1DlKyK1q+HVbX1qArjDmrptzkEQQzCMRBQaGpvrZzYPAjnBuSkRMK0R7va4bE3FLjaL2jFNFGYxF1owbUPD/l6GfJeSWreki9Y2lpuf/T/7VYv/e6l3rLlWDk7rHFWgafCCj3HwB+kxd1vT89MTzmbhHzNVASEkpBDlDyQVKHVAk8g2Ez0wqwRf9WHfJimcyNDmeRisEixBKdVQ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 831878c6-6462-4a74-d02a-08d79263eca0 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Jan 2020 04:50:16.4035 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: re9/djhsVKbft3VgAsgeQTb1AtX5g8dYW2SGs5q2K1wJQbodlux4nPd9qP+c6tS8YjmNESpewSQF/O0Ctbgw0FXU9bQyDk/biq5QrPbaYVY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1801MB1816 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2020-01-05_08:2020-01-02,2020-01-05 signatures=0 Subject: Re: [dpdk-dev] [PATCH v2 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" >> 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 0ae64dd41..68998f42c 100644 >> --- a/examples/l3fwd/main.c >> +++ b/examples/l3fwd/main.c >> @@ -920,7 +920,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; >> @@ -1195,27 +1195,46 @@ main(int argc, char **argv) >> } >> } >> >> - >> check_all_ports_link_status(enabled_port_mask); >> >> ret =3D 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 =3D -1; >> - break; >> + if (evt_rsrc->enabled) { >> + for (i =3D 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 =3D 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(portid) { >> + if ((enabled_port_mask & (1 << portid)) =3D=3D 0) >> + continue; >> + rte_eth_dev_stop(portid); >> } >> - } >> >> - /* stop ports */ >> - RTE_ETH_FOREACH_DEV(portid) { >> - if ((enabled_port_mask & (1 << portid)) =3D=3D 0) >> - continue; >> - printf("Closing port %d...", portid); >> - rte_eth_dev_stop(portid); >> - rte_eth_dev_close(portid); >> - printf(" Done\n"); > >Why to stop ports *before* making sure all lcores are stopped? >Shouldn't that peace of code be identical for both poll and event mode? >Something like: >rte_eal_mp_wait_lcore(); > > RTE_ETH_FOREACH_DEV(portid) { > if ((enabled_port_mask & (1 << portid)) =3D=3D 0) > continue; > rte_eth_dev_stop(portid); > rte_eth_dev_close(portid); > } >? > Event dev spec requires stopping producers before consumers else we might r= un into=20 deadlock in some cases. >> + rte_eal_mp_wait_lcore(); >> + RTE_ETH_FOREACH_DEV(portid) { >> + if ((enabled_port_mask & (1 << portid)) =3D=3D 0) >> + continue; >> + rte_eth_dev_close(portid); >> + } >> + >> + 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(portid) { >> + if ((enabled_port_mask & (1 << portid)) =3D=3D 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