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 55485A054F for ; Tue, 28 Jun 2022 15:35:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4E2BF400D7; Tue, 28 Jun 2022 15:35:44 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2058.outbound.protection.outlook.com [40.107.92.58]) by mails.dpdk.org (Postfix) with ESMTP id E3F19400D7 for ; Tue, 28 Jun 2022 15:35:42 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b7D3/dmHz/xAsoa+AzSAS1ug+2BYBG6UjYzRSNIG8bi7miLByJVCVTmol3nHlaov0KEdfNXEN+hrs+arXZFuxjowFs4nTMYO0/5hMy8AohWJ+zcR9OHFQEGdVgW/0PoWPBbxyQVpvtM+ppDVR887YaZkCq7+4kWv/h2TRW7ma3cT1joAcJwiqD0T1/W7W8Ag/evl4+EAY5MCDWZq85PoJjRvlVWuaFxInoSPMZ9WIyriOBc4i1qS6oOQQy6OxZ9grtws5Yu78tvGYn1hm5xMLFK9XYwzfr5/KFvaCK6aqtQMym8sNPs5U8B1YXv4/SkYOM2thF3BvlNq1cm1jOb7Fg== 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=SY0uA+fkazcskpMAnJoZgT2AH09HsHlFc0rv5wVLAHs=; b=nR48Rn6hGFxj720w9reIv8/Z14IF1MKiYffusaq2kV/lhSixjWHAoSMWJFs9Qc4/D98L3wB01PVgVvNCiUosOZ4V+Hq0phRdyW6vuY7iS4HZN7hbKg4kwzdhaPo1s9NHRMAMe+h49uwVzeNZ0U5ICqUJQyZo+Ibx71P4AeafVXgM3/QN/XlUBDsbo2mwYG1N5io7YLTO1wk9pr5kvAVi5n1wcy/fwglmuHbR/YiKFmJpGa0hHauh/kpzGFKRNTrmrVJUyU30jq99C0bwNszHahw5hivTYjn4Po8OJ3WFtAMcCYK3rD4tdTEfHvQZdFjDZ8hQZ7IRiLd9gCSzy1/0Fg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SY0uA+fkazcskpMAnJoZgT2AH09HsHlFc0rv5wVLAHs=; b=LMmG9kAPke/9Ms+jSdqngKUPGgMYBXrdxQTGxqUS7G2Uca80xfFOi9ghENntIcSChV+oXnqI63VTlr19BKUCmMu/MsW/1JQ6ZzLgH9EkmQ8vpdkHLsxf25spDhszbu5vuziwBMcHTGd7TxYSgTBdN7KsAdqPzHYXQthOw1FlF/npijvMmGETOafjdMZ1ong9BM8Hnb7tzphMbOGWWRwXJTkm6HUIc6ESoLHEinVANN/JEEqBv+u86xbW9teu0uGeP1SZSd7W1EYsIOUoF3QgsKUsboN6UdUW5IX9Xdl5+kn6g0w3yd2/jUq+iOH9wmg0BLEhnmk2UiHV/PSIGPiP8g== Received: from DM4PR12MB5373.namprd12.prod.outlook.com (2603:10b6:5:39d::14) by BN8PR12MB3361.namprd12.prod.outlook.com (2603:10b6:408:67::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.16; Tue, 28 Jun 2022 13:35:41 +0000 Received: from DM4PR12MB5373.namprd12.prod.outlook.com ([fe80::9416:525c:ef8d:6bcd]) by DM4PR12MB5373.namprd12.prod.outlook.com ([fe80::9416:525c:ef8d:6bcd%9]) with mapi id 15.20.5373.018; Tue, 28 Jun 2022 13:35:41 +0000 From: "Xueming(Steven) Li" To: Huisong Li , "stable@dpdk.org" , "ktraynor@redhat.com" CC: "liudongdong3@huawei.com" , "huangdaode@huawei.com" Subject: RE: [PATCH 20.11 V2] app/testpmd: fix port status of bonding slave device Thread-Topic: [PATCH 20.11 V2] app/testpmd: fix port status of bonding slave device Thread-Index: AQHYipesB113zpRw+EirCm0DgwDxO61k0p9Q Date: Tue, 28 Jun 2022 13:35:41 +0000 Message-ID: References: <20220628021459.51964-1-lihuisong@huawei.com> <20220628023311.55928-1-lihuisong@huawei.com> In-Reply-To: <20220628023311.55928-1-lihuisong@huawei.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 43375a9d-84a1-4023-4b21-08da590b184d x-ms-traffictypediagnostic: BN8PR12MB3361:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: klSAi1QyyJWRQrRUasc5DFYgZVq3XADjZpTCVwc4UDRWR2EIRi0Ju45n7CThlVIne0+Z9xQuLAHIEaDmZF9babKSKBZRO/98cCbq/PXYKreFO9btq/pu/u0cxsrS6+4cuVhXPOY9dKEJo+LkhNHEP4Gd+NNf0jaIXAmRFJg135IavlCcy+143LXJWbqbYESJZOaThUizO+ZA8xNcsyTxEb+6iG2dxRYYt6rDwHP/DHXxbJSlOQBiDkeSHBWJtFvsSx7niGWHiEwgiQA1unhPPt+U/WSHg1SfPojxdo7IFqbak7NgMJ0DPPuyKvbhhXkwtFGEwLZejbUA+w3SJRMbOt/8ZfvIChqz4cJE7Q4VLiraYoDRDz3z1uC6+KEYqVTxe1yZf4BD1q0eqTk4PL2Y413nBZfJghDi+QMuqeaPc41zZtkgt5kITLO2oeJjjrnpla8ndXd0kDuZpm5D6lvB6jUZQwJFDgyxnrE4tUB8CHUmqA+wEFuw9reEQbBLW6HFXa4QCj7ckoA0Ptt9jSt/ou9VKfHvcVvntlNADbiMD4EhX+uq/ZNOJVaY1DmpkDbjeDRVEqSYQZC+ozB+zjzrPf+I4+MrvhMFmdAHbBLrARGcUCbkH7mTx7ZTNr17c6WcG4yPy+cgt/cPh1TEyh/ByXRM1k6K2iUn2N0KR7BcXeqKsIGw96RSiiRpg5maqSdvfSZS1B8LHl/SBLT8/khJfPgInQqVc4ogxx5Aqv0XFZcjkaFNOP9t08qB+m2EfjajR08FCb0/R3Ag8L50wo+9hPrHEE/AameZCQlJZgG7sBw= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR12MB5373.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(366004)(396003)(376002)(346002)(136003)(39860400002)(26005)(6506007)(186003)(54906003)(41300700001)(83380400001)(9686003)(7696005)(55016003)(53546011)(110136005)(122000001)(66476007)(33656002)(478600001)(86362001)(8676002)(8936002)(76116006)(66946007)(2906002)(66556008)(52536014)(38100700002)(38070700005)(5660300002)(316002)(66446008)(71200400001)(4326008)(64756008); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?/KJM09+SszCdHHNUIvtHaui3DS6oAhRF4h2EDRMLRIqsw32omH2gyOcf5+9d?= =?us-ascii?Q?04wqRJpEm2MJjM8H0z82Y3h5GHLZtzfoQIiIhUvGQSkf9aSrctzY4tOOzuLJ?= =?us-ascii?Q?PW4rNY8UQXT7Ae1Pec9SQ4murAcUtQwoJ8Y5Jbq8wZ7YwTsQdxhLtbHJaSQn?= =?us-ascii?Q?QtL4+qJkz76byaAjMVd15oTP5kpthH9wYFaG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=?us-ascii?Q?zp7nK8yb6agGTMeXYgW3gn7MhD0WjoWMiTGtz+vywon0dhVsMmV4pIPEFQzK?= =?us-ascii?Q?D4Jn2K1rg1mUs+4g3tsjLwwKdwTWn8th9KFG6DRc5yXXt+pYlNm3+7TymAzl?= =?us-ascii?Q?zoY9nFPdZ2kqEUyVY9yELQcvCEO5zhe7JgESFBwW7kLSsDX+Gbtkxm8fA3F5?= =?us-ascii?Q?7/F4z0AKi126w8bQI5W1A+ABNmyT93sV9e5BlNEEcTsEXTnvodOQ9aAdWSnh?= =?us-ascii?Q?P8sJJ/hCOPW65wH8fTNO3/vro2M4mUDbpqS6eMiMyjjEr219OD5aR214Uq3b?= =?us-ascii?Q?DWafgEmW2b8E1qGPRgL2d/wH5LWZhHxFB8/OYZtfDmk3cYM2R4tFhSLZd/tK?= =?us-ascii?Q?dLFPhIDTBerrUamEzC6uv7FY9xHn5eYvlZeHM4BQ5OL/REwkt/F7dVNvoE2V?= =?us-ascii?Q?Eq/5hwcQ6baCxzQVeRQFfBML6h2KR2CKuhtDyTfc5OuOqujsISKcwmIlyzSQ?= =?us-ascii?Q?c1ytCO46tETfKwVWIhe68858esE3noGLzIshAkL8?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 43375a9d-84a1-4023-4b21-08da590b184d X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Jun 2022 13:35:41.3265 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 48KNolaOZ/vdjB3RsjQLeO4dIkyKpEbP3P9q1qOvQxA+fKXfISjm9hTFQVvNAMp0WGW1NLqtCT3bG15UWEOnSA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3361 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Thanks, applied into 20.11 LTS queue. > -----Original Message----- > From: Huisong Li > Sent: Tuesday, June 28, 2022 10:33 AM > To: stable@dpdk.org; Xueming(Steven) Li ; ktraynor@r= edhat.com > Cc: lihuisong@huawei.com; liudongdong3@huawei.com; huangdaode@huawei.com > Subject: [PATCH 20.11 V2] app/testpmd: fix port status of bonding slave d= evice >=20 > [ upstream commit e46372d7b082706718bb17981ae632e4e4d56414 ] >=20 > Starting or stopping a bonded port also starts or stops all active slaves= under the bonded port. If this port is a bonded device, we need to > modify the port status of all slaves. >=20 > Fixes: 0e545d3047fe ("app/testpmd: check stopping port is not in bonding"= ) >=20 > --- > v2: > - clear checkpatch warning >=20 > Signed-off-by: Huisong Li > Signed-off-by: Min Hu (Connor) > Acked-by: Aman Singh > Acked-by: Konstantin Ananyev > --- > app/test-pmd/cmdline.c | 1 + > app/test-pmd/testpmd.c | 55 ++++++++++++++++++++++++++++++++++++++++++ > app/test-pmd/testpmd.h | 3 ++- > 3 files changed, 58 insertions(+), 1 deletion(-) >=20 > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 1741d0= 0ba8..535d199040 100644 > --- a/app/test-pmd/cmdline.c > +++ b/app/test-pmd/cmdline.c > @@ -6328,6 +6328,7 @@ static void cmd_create_bonded_device_parsed(void *p= arsed_result, > printf("Failed to enable promiscuous mode for port %u: %s - ignore\n"= , > port_id, rte_strerror(-ret)); >=20 > + ports[port_id].bond_flag =3D 1; > ports[port_id].need_setup =3D 0; > ports[port_id].port_status =3D RTE_PORT_STOPPED; > } > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 1a7488= d8dc..7b1d65ea08 100644 > --- a/app/test-pmd/testpmd.c > +++ b/app/test-pmd/testpmd.c > @@ -60,6 +60,9 @@ > #ifdef RTE_LIB_LATENCYSTATS > #include > #endif > +#ifdef RTE_NET_BOND > +#include > +#endif >=20 > #include "testpmd.h" >=20 > @@ -2420,6 +2423,38 @@ rx_queue_setup(uint16_t port_id, uint16_t rx_queue= _id, > return ret; > } >=20 > +static int > +change_bonding_slave_port_status(portid_t bond_pid, bool is_stop) { > +#ifdef RTE_NET_BOND > + > + portid_t slave_pids[RTE_MAX_ETHPORTS]; > + struct rte_port *port; > + int num_slaves; > + portid_t slave_pid; > + int i; > + > + num_slaves =3D rte_eth_bond_slaves_get(bond_pid, slave_pids, > + RTE_MAX_ETHPORTS); > + if (num_slaves < 0) { > + fprintf(stderr, "Failed to get slave list for port =3D %u\n", > + bond_pid); > + return num_slaves; > + } > + > + for (i =3D 0; i < num_slaves; i++) { > + slave_pid =3D slave_pids[i]; > + port =3D &ports[slave_pid]; > + port->port_status =3D > + is_stop ? RTE_PORT_STOPPED : RTE_PORT_STARTED; > + } > +#else > + RTE_SET_USED(bond_pid); > + RTE_SET_USED(is_stop); > +#endif > + return 0; > +} > + > int > start_port(portid_t pid) > { > @@ -2603,6 +2638,15 @@ start_port(portid_t pid) > "stopped\n", pi); > continue; > } > + /* > + * Starting a bonded port also starts all slaves under the > + * bonded device. So if this port is bond device, we need > + * to modify the port status of these slaves. > + */ > + if (port->bond_flag =3D=3D 1) { > + if (change_bonding_slave_port_status(pi, false) !=3D 0) > + continue; > + } >=20 > if (rte_atomic16_cmpset(&(port->port_status), > RTE_PORT_HANDLING, RTE_PORT_STARTED) =3D=3D 0) @@ -2731,6 +2775,17 @@= stop_port(portid_t pid) > if (rte_eth_dev_stop(pi) !=3D 0) > RTE_LOG(ERR, EAL, "rte_eth_dev_stop failed for port %u\n", > pi); > + /* > + * Stopping a bonded port also stops all slaves under the bonded > + * device. So if this port is bond device, we need to modify the > + * port status of these slaves. > + */ > + if (port->bond_flag =3D=3D 1) { > + if (change_bonding_slave_port_status(pi, true) !=3D 0) { > + RTE_LOG(ERR, EAL, "Fail to change bonding slave port status %u\n", > + pi); > + } > + } >=20 > if (rte_atomic16_cmpset(&(port->port_status), > RTE_PORT_HANDLING, RTE_PORT_STOPPED) =3D=3D 0) diff --git a/app/test-= pmd/testpmd.h b/app/test-pmd/testpmd.h > index 2d4dc05332..3b4b943c96 100644 > --- a/app/test-pmd/testpmd.h > +++ b/app/test-pmd/testpmd.h > @@ -219,7 +219,8 @@ struct rte_port { > struct rte_eth_txconf tx_conf[RTE_MAX_QUEUES_PER_PORT+1]; /**< per qu= eue tx configuration */ > struct rte_ether_addr *mc_addr_pool; /**< pool of multicast addrs */ > uint32_t mc_addr_nb; /**< nb. of addr. in mc_addr_pool *= / > - uint8_t slave_flag; /**< bonding slave port */ > + uint8_t slave_flag : 1, /**< bonding slave port */ > + bond_flag : 1; /**< port is bond device */ > struct port_flow *flow_list; /**< Associated flows. */ > struct port_shared_action *actions_list; > /**< Associated shared actions. */ > -- > 2.33.0