From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 83C36A0C53; Tue, 16 Nov 2021 22:34:41 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 670DB40141; Tue, 16 Nov 2021 22:34:41 +0100 (CET) Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40062.outbound.protection.outlook.com [40.107.4.62]) by mails.dpdk.org (Postfix) with ESMTP id A1FD540040 for ; Tue, 16 Nov 2021 22:34:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OcBBLFPUEZaGdJOHNS8JzDM+4Lx2wH8Ipv+o1dAnkZk=; b=4zfRvOSMhfrCmaq2SL7NobHGE0SvLTBSiQky1mf7Q/scd+VefkiPP/27vaapUGLL5PYyA+xW6qVflD9N1ZF7IirKzEg/g1PxeQPztsxBogRnEzd/QI9U/tFkzhQKOkYcU3nuihfX7GQ3gRaytjDUFTjfi42nJBSr8FnnLyStfbA= Received: from AS9PR0301CA0015.eurprd03.prod.outlook.com (2603:10a6:20b:468::23) by VI1PR08MB5533.eurprd08.prod.outlook.com (2603:10a6:803:12d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Tue, 16 Nov 2021 21:34:39 +0000 Received: from VE1EUR03FT010.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:468:cafe::f2) by AS9PR0301CA0015.outlook.office365.com (2603:10a6:20b:468::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.26 via Frontend Transport; Tue, 16 Nov 2021 21:34:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT010.mail.protection.outlook.com (10.152.18.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.20 via Frontend Transport; Tue, 16 Nov 2021 21:34:38 +0000 Received: ("Tessian outbound 9a8c656e7c94:v110"); Tue, 16 Nov 2021 21:34:38 +0000 X-CR-MTA-TID: 64aa7808 Received: from 3a4d4621e6f2.3 by 64aa7808-outbound-1.mta.getcheckrecipient.com id F9BBA914-00E8-4963-BBAD-5140A9E3E7BE.1; Tue, 16 Nov 2021 21:34:27 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 3a4d4621e6f2.3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 16 Nov 2021 21:34:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XZf5M9ChYLVd7ERpwdX6BluxNhzE3QO7+9SdgzWRNHwv4paQ1zCcsLF6iiwL9rtfRAZjieRYXMzcA1IvQf+wxpNYG9Fa/ntXcesJO7vVs4mP327C2M85Kw51d0F30ckbc+urAPKoLTh1ki6ZsR0ytF7l1fo2reyul5O9IGEI7ct01s0djtPXMNUkYguvXC63gCv+gHo1r+Z9n7IEdJpUuR60S/IERDaHuUmQ3dFbStL+jNFQVHYZf0wFa90/zHUMpOXaaWvP/7Wlaa4mec9YlZm67FHa7njz0nJmXJm0hK/LYut9bUQ5iR1HgOtWin8dHFAkAh1t5URhGt16i2lyOQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OcBBLFPUEZaGdJOHNS8JzDM+4Lx2wH8Ipv+o1dAnkZk=; b=MsZqZaD6LmDuohIizq085S+uMRCyT1e5tNwRBtKlUmB67sCn8KmuvT7a1vl26BkfYFRxTHtSaJxHD7g/AmcAorQkCaF1e0aNU3zhmnARVjPPoPnVPkUp9jw+pkfAsMiZF3zp7Yg172WGCiQzqxEr8CcGdrPV5gufmMAj9PScT0zywQen3VhYE1REwPAb+dXUKS+9j9ucgbAII3nbI9ODqjLj3mqKGhqL6HvwhX76skhMw7Pjr7gXFqEmK53TtxZxO9ScrRWBELMY7pEU+isrcSrGvKUIFxwtvfMqTKFp6hOpCw340QgwEHT64eDWe5H75ZBVSRXsFVsThGmuWFjG0A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OcBBLFPUEZaGdJOHNS8JzDM+4Lx2wH8Ipv+o1dAnkZk=; b=4zfRvOSMhfrCmaq2SL7NobHGE0SvLTBSiQky1mf7Q/scd+VefkiPP/27vaapUGLL5PYyA+xW6qVflD9N1ZF7IirKzEg/g1PxeQPztsxBogRnEzd/QI9U/tFkzhQKOkYcU3nuihfX7GQ3gRaytjDUFTjfi42nJBSr8FnnLyStfbA= Received: from DBAPR08MB5814.eurprd08.prod.outlook.com (2603:10a6:10:1b1::6) by DB6PR0801MB1702.eurprd08.prod.outlook.com (2603:10a6:4:2f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Tue, 16 Nov 2021 21:34:25 +0000 Received: from DBAPR08MB5814.eurprd08.prod.outlook.com ([fe80::8501:86ca:a393:17b7]) by DBAPR08MB5814.eurprd08.prod.outlook.com ([fe80::8501:86ca:a393:17b7%9]) with mapi id 15.20.4713.019; Tue, 16 Nov 2021 21:34:25 +0000 From: Honnappa Nagarahalli To: Joyce Kong , Xiaoyun Li CC: "dev@dpdk.org" , nd , Joyce Kong , Ruifeng Wang , nd Subject: RE: [PATCH v2 10/12] app/testpmd: remove atomic operations for port status Thread-Topic: [PATCH v2 10/12] app/testpmd: remove atomic operations for port status Thread-Index: AQHX2s5o6kaS0YGDLk2Ajuo5QLX8WawGraRQ Date: Tue, 16 Nov 2021 21:34:25 +0000 Message-ID: References: <20211116094205.750359-1-joyce.kong@arm.com> <20211116094205.750359-11-joyce.kong@arm.com> In-Reply-To: <20211116094205.750359-11-joyce.kong@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 9C93C0B9F5A4D14084B7420DBE5802D3.0 x-checkrecipientchecked: true Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: 55df0247-5cbd-4b3b-4b03-08d9a948e4cf x-ms-traffictypediagnostic: DB6PR0801MB1702:|VI1PR08MB5533: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:65;OLM:65; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: Zt9BogOOuqMjP6MOEdiSUnNL9pLJGLory4PIONAh3hOFbqvHYN+WJfyjnP9juXKVQSE8PilU+vXaChV4vse8wtFB0zsES152w3/ke8GDJSgTlMpNipRviSBEhDA+luaMQWNXK1sdYXEHRED4osl4GEtuZsqgllsoTs/FJljbZ7MQffhcf7UjNK3e2oK3yN6z+fPoJoq6Tv2plUH87Jw0oFTx1kqDL0lHTWaBzHovm6xN5WI+RRgeClHgbmUUhkz5+wGEOqV7ix1FXlKbFOsmGt4WtPK+uPwczSs0JDS48P8YZ+zxjZv37MD8dMKIZLVsETAbp0wE5FR+XpUamt/deTQa5GNIePnPZEEHP747CPkVuhZnzgF/NQm2uf+2OlFd4foIRqWZVsijcHPF16DuGt+0Kynb2z7gGN/IW8cDEUGB1rEE0T+0stztlwBjuPhES+HmtzEhD7vS8UAsOft4abcFXpdxueVzk+PbKbNd5ovGeVoZl2O4HHwippGyxtwyOzdB8Zbkt4cYKr5Eg0yUicnKlinXWHeOEAlZCNLiqW61YRKGxMzOddMJx2mrTzaP2XLQj0ZEqQvWd/OHHlHo3mWAlD5IHb6AwlucXcdKWwTJOWBGYTm85Nc4PigSCuw9meE3l3oY4tcfk2Flz64RLjnTeXM3gkqXK03FHBES7dnYNyDIlWjjihC0E5MaNormiI9+4J7xyt0E5JWU7Ch7ZQ== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBAPR08MB5814.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(508600001)(7696005)(2906002)(66946007)(33656002)(110136005)(316002)(38070700005)(83380400001)(66476007)(66556008)(66446008)(64756008)(122000001)(76116006)(186003)(8936002)(54906003)(4326008)(71200400001)(6506007)(5660300002)(86362001)(52536014)(38100700002)(26005)(9686003)(8676002)(55016002); DIR:OUT; SFP:1101; Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1702 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT010.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 7c83a0a8-e000-4c44-46f8-08d9a948dcb2 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BRadhqN13g7g/HxJuG1/IJmEMmSY7fVwKP6UTF2FO51cS0uziYjKP7ozz2tUBFObS1xYVWQrYODkU1JvzXSdeqOWSmUqrKWyYgONBGz5dcrBBp/3i3jB9DYvocNmlRcm5AaOsXKytvXFASVn5UtannTu0sCAAUNkBYMz07n4KAJZj8WtHEdJSdxMChaicI1B/z1IivFT0OcEShjk/8IBrBD4/2O1dAUxNUfhHT4r97s26MW8POatIbZQcw6SKFDXleKIy9niopAxccX6mU8k/pI2pwyJJ1fch/eZqVhVChPwGnm9iWPtTwCVyxdKlcufCDLGUO1swJ+Kwndcnp8fYBUc0Ihe3bDqDmFXshisKomO0Rodvzuxz2c6SydKoCeUBW2zqtYj5jGmsCCseLqw6Jc09JQaEBk2ScO+GsRDxnpvqn4nVCiF3Ogn9AlUKUMyco/Rwioux1Hffs5s29JwPvfPcHDAAkApe9RzwlbCJxd9JfwP+MRVJ1KF9nt1xP+TA4pTqe1C0najADPe946er/1MWCE0H3RLcDiC4JxODZkk4KMpV70xRFnhhpO+ULfVNFij95z6AZzQtEsSKpLiXfVo4DT5aVUdc6rN3wDeS1aUAPN0lL4UQRtAnRU/VshWqVQ05uBImmADj7r7v2RIBfySq2gDBptbYW4q5Il33k66w9VtGe7YePwMDKiQkdpHVEO2ToX/nfAOw2rVF7jMiQ== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(5660300002)(316002)(47076005)(70586007)(52536014)(8676002)(70206006)(36860700001)(110136005)(54906003)(82310400003)(8936002)(4326008)(336012)(83380400001)(81166007)(55016002)(9686003)(33656002)(7696005)(26005)(508600001)(6506007)(2906002)(86362001)(356005)(186003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2021 21:34:38.9746 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 55df0247-5cbd-4b3b-4b03-08d9a948e4cf X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT010.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB5533 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org >=20 > The port_status changes do not need to be handled atomically, as they are > modified during initialization or through the testpmd prompt instead of > multiple threads. >=20 > Signed-off-by: Joyce Kong > Reviewed-by: Ruifeng Wang Reviewed-by: Honnappa Nagarahalli > --- > app/test-pmd/testpmd.c | 58 ++++++++++++++++++++++-------------------- > 1 file changed, 31 insertions(+), 27 deletions(-) >=20 > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index > a66dfb297c..ed472cacd2 100644 > --- a/app/test-pmd/testpmd.c > +++ b/app/test-pmd/testpmd.c > @@ -36,7 +36,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -2521,9 +2520,9 @@ setup_hairpin_queues(portid_t pi, portid_t p_pi, > uint16_t cnt_pi) > continue; >=20 > /* Fail to setup rx queue, return */ > - if (rte_atomic16_cmpset(&(port->port_status), > - RTE_PORT_HANDLING, > - RTE_PORT_STOPPED) =3D=3D 0) > + if (port->port_status =3D=3D RTE_PORT_HANDLING) > + port->port_status =3D RTE_PORT_STOPPED; > + else > fprintf(stderr, > "Port %d can not be set back to stopped\n", > pi); > fprintf(stderr, "Fail to configure port %d hairpin queues\n", > @@ -2544,9 +2543,9 @@ setup_hairpin_queues(portid_t pi, portid_t p_pi, > uint16_t cnt_pi) > continue; >=20 > /* Fail to setup rx queue, return */ > - if (rte_atomic16_cmpset(&(port->port_status), > - RTE_PORT_HANDLING, > - RTE_PORT_STOPPED) =3D=3D 0) > + if (port->port_status =3D=3D RTE_PORT_HANDLING) > + port->port_status =3D RTE_PORT_STOPPED; > + else > fprintf(stderr, > "Port %d can not be set back to stopped\n", > pi); > fprintf(stderr, "Fail to configure port %d hairpin queues\n", > @@ -2729,8 +2728,9 @@ start_port(portid_t pid) >=20 > need_check_link_status =3D 0; > port =3D &ports[pi]; > - if (rte_atomic16_cmpset(&(port->port_status), > RTE_PORT_STOPPED, > - RTE_PORT_HANDLING) =3D=3D 0) > { > + if (port->port_status =3D=3D RTE_PORT_STOPPED) > + port->port_status =3D RTE_PORT_HANDLING; > + else { > fprintf(stderr, "Port %d is now not stopped\n", pi); > continue; > } > @@ -2766,8 +2766,9 @@ start_port(portid_t pid) > nb_txq + nb_hairpinq, > &(port->dev_conf)); > if (diag !=3D 0) { > - if (rte_atomic16_cmpset(&(port- > >port_status), > - RTE_PORT_HANDLING, RTE_PORT_STOPPED) > =3D=3D 0) > + if (port->port_status =3D=3D > RTE_PORT_HANDLING) > + port->port_status =3D > RTE_PORT_STOPPED; > + else > fprintf(stderr, > "Port %d can not be set back > to stopped\n", > pi); > @@ -2828,9 +2829,9 @@ start_port(portid_t pid) > continue; >=20 > /* Fail to setup tx queue, return */ > - if (rte_atomic16_cmpset(&(port- > >port_status), > - > RTE_PORT_HANDLING, > - RTE_PORT_STOPPED) > =3D=3D 0) > + if (port->port_status =3D=3D > RTE_PORT_HANDLING) > + port->port_status =3D > RTE_PORT_STOPPED; > + else > fprintf(stderr, > "Port %d can not be set back > to stopped\n", > pi); > @@ -2880,9 +2881,9 @@ start_port(portid_t pid) > continue; >=20 > /* Fail to setup rx queue, return */ > - if (rte_atomic16_cmpset(&(port- > >port_status), > - > RTE_PORT_HANDLING, > - RTE_PORT_STOPPED) > =3D=3D 0) > + if (port->port_status =3D=3D > RTE_PORT_HANDLING) > + port->port_status =3D > RTE_PORT_STOPPED; > + else > fprintf(stderr, > "Port %d can not be set back > to stopped\n", > pi); > @@ -2917,16 +2918,18 @@ start_port(portid_t pid) > pi, rte_strerror(-diag)); >=20 > /* Fail to setup rx queue, return */ > - if (rte_atomic16_cmpset(&(port->port_status), > - RTE_PORT_HANDLING, RTE_PORT_STOPPED) > =3D=3D 0) > + if (port->port_status =3D=3D RTE_PORT_HANDLING) > + port->port_status =3D RTE_PORT_STOPPED; > + else > fprintf(stderr, > "Port %d can not be set back to > stopped\n", > pi); > continue; > } >=20 > - if (rte_atomic16_cmpset(&(port->port_status), > - RTE_PORT_HANDLING, RTE_PORT_STARTED) =3D=3D 0) > + if (port->port_status =3D=3D RTE_PORT_HANDLING) > + port->port_status =3D RTE_PORT_STARTED; > + else > fprintf(stderr, "Port %d can not be set into started\n", > pi); >=20 > @@ -3028,8 +3031,9 @@ stop_port(portid_t pid) > } >=20 > port =3D &ports[pi]; > - if (rte_atomic16_cmpset(&(port->port_status), > RTE_PORT_STARTED, > - RTE_PORT_HANDLING) =3D=3D 0) > + if (port->port_status =3D=3D RTE_PORT_STARTED) > + port->port_status =3D RTE_PORT_HANDLING; > + else > continue; >=20 > if (hairpin_mode & 0xf) { > @@ -3055,8 +3059,9 @@ stop_port(portid_t pid) > RTE_LOG(ERR, EAL, "rte_eth_dev_stop failed for port > %u\n", > pi); >=20 > - if (rte_atomic16_cmpset(&(port->port_status), > - RTE_PORT_HANDLING, RTE_PORT_STOPPED) =3D=3D 0) > + if (port->port_status =3D=3D RTE_PORT_HANDLING) > + port->port_status =3D RTE_PORT_STOPPED; > + else > fprintf(stderr, "Port %d can not be set into > stopped\n", > pi); > need_check_link_status =3D 1; > @@ -3119,8 +3124,7 @@ close_port(portid_t pid) > } >=20 > port =3D &ports[pi]; > - if (rte_atomic16_cmpset(&(port->port_status), > - RTE_PORT_CLOSED, RTE_PORT_CLOSED) =3D=3D 1) { > + if (port->port_status =3D=3D RTE_PORT_CLOSED) { > fprintf(stderr, "Port %d is already closed\n", pi); > continue; > } > -- > 2.25.1