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 18B84A0546; Fri, 30 Apr 2021 05:19:21 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8D3154069E; Fri, 30 Apr 2021 05:19:20 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id DA28640395 for ; Fri, 30 Apr 2021 05:19:17 +0200 (CEST) IronPort-SDR: o5KfBkUFzZTzRL7KMEdEFp8nldLOdKu7SGUtcSJj8f1l1i2mdkRkcOfmPRmRKlf5HoHmJUnzNg usGv+hwgVPhw== X-IronPort-AV: E=McAfee;i="6200,9189,9969"; a="195075775" X-IronPort-AV: E=Sophos;i="5.82,260,1613462400"; d="scan'208";a="195075775" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2021 20:19:15 -0700 IronPort-SDR: DDMfey7fczGNl6hgqzgA7GqXYX3qoVuVSjqH3qgZfQU5Q4IOHeh/2u3EZufYcWL0jSQM76oNbx vp6dtPajw/Qw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,260,1613462400"; d="scan'208";a="527437368" Received: from orsmsx604.amr.corp.intel.com ([10.22.229.17]) by fmsmga001.fm.intel.com with ESMTP; 29 Apr 2021 20:19:15 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX604.amr.corp.intel.com (10.22.229.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Thu, 29 Apr 2021 20:19:14 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Thu, 29 Apr 2021 20:19:14 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Thu, 29 Apr 2021 20:19:14 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.176) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2106.2; Thu, 29 Apr 2021 20:19:14 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OEFM1c55NL63+KnPUiw1o1r9soOQH18QPHv13bbrDplh+CdWq/CZOp7+1zfJj2S0914RWF+I3ZyndblFEttLGSbgll1cti7NZfwm1VJkDhhARwmwcZGcZ1nivrPhBvqjX4qp7bY3mH9a9x6+3F8UBmwmM0si79vrNfBfOolj43VarPCmoDinS8a//oIrPDJJHAOUJhX5OL1n0Azt2C4ObayiP9GysbXq3CbgYZSX207N2NHEmUdkmJ5gVeSaBl4oG75PNfk2aA7VGhjx6/+1rO/Q50wqutYUerFskH5foVKfJpxv6Giuxvgpgk1v04nsRZbrDJrULNZligRzeTcrHg== 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=ahi84erSJkCWPxiLp9Rt1YYTluyJA52y/MyfNawxV/4=; b=TDZPGYHkgfoNlyZ/V66UpK4byJxkFjx9bho/Ei8SG8ACu0wv/eiqj9wa+pW76yZwy4/zHN2te4/ib1tpDhuuieTsRDpB8DYnihrxbMfOFfPuVtJ3kRC1gDMphzSzezs2ewXzAX2q2l+6zjB5wrYvfCZFmcvYEpRGkajh8RXBWYRwtNAY40C/lYHWM9aMs+8HCK5ImFH46od8UDZQA1+I52hkagnvBIzLHDTbzfN6YKozdjnbjN2JTzA2lZ2que9ILnuhzTqaTDD2t136x0I/ZwD0Q75hXNTB9jtjVH0ueOmiQPno/MMZBSdOTAG5SnYsHzyW65bN7pl25qus8O6HgQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ahi84erSJkCWPxiLp9Rt1YYTluyJA52y/MyfNawxV/4=; b=wZP5fFXaVTVPa0D85Tit4gZKR7McHqf7FnL29Sbvy03O00Fop/Xmwh6s5AEfTp1OOJ5SG3Mz6fQimau2OzogPNwQB7szPvWUtagq8JYwF/VUgEqjWps6nnAcMVGWtGbvflsbpRmyjny78vF+ZsyX0ZrYX1QPa6RvhpFcAa6oEZI= Received: from DM4PR11MB5534.namprd11.prod.outlook.com (2603:10b6:5:391::22) by DM6PR11MB4475.namprd11.prod.outlook.com (2603:10b6:5:14e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.22; Fri, 30 Apr 2021 03:19:09 +0000 Received: from DM4PR11MB5534.namprd11.prod.outlook.com ([fe80::9034:15e:7cf3:4b78]) by DM4PR11MB5534.namprd11.prod.outlook.com ([fe80::9034:15e:7cf3:4b78%4]) with mapi id 15.20.4087.026; Fri, 30 Apr 2021 03:19:09 +0000 From: "Li, Xiaoyun" To: "Min Hu (Connor)" , "dev@dpdk.org" CC: "Yigit, Ferruh" Thread-Topic: [PATCH v2 1/2] app/testpmd: add link speed check before port start Thread-Index: AQHXPAm4iDqDa0Q+5UyGv4nRs/jke6rMU/sw Date: Fri, 30 Apr 2021 03:19:09 +0000 Message-ID: References: <1618813303-32945-1-git-send-email-humin29@huawei.com> <1619599019-46246-1-git-send-email-humin29@huawei.com> <1619599019-46246-2-git-send-email-humin29@huawei.com> In-Reply-To: <1619599019-46246-2-git-send-email-humin29@huawei.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: huawei.com; dkim=none (message not signed) header.d=none;huawei.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.53] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b7ab4569-5bd6-4ec7-53da-08d90b86b82e x-ms-traffictypediagnostic: DM6PR11MB4475: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Bq5NKhpL6UeGc1l6fqFjMKCQHgFavhuvH2wGFBhoY8awlf1qGPgToX2hAZC2hT3HlzuRkAjTE6SwFkpdrTw4VYW0n7u4zucKkAjZPS0xkoT1OrlB00VCnx/flcFpCAD7RwjynHOJr4OZour3CnK0/J7WlyZ2OsxV2KIWvylloGwCxwEP+JfLNxldD+K+9jrFkAqSowtusyPYm7OO4F9kBz8KgBXC59qKy8bLEEY4+I3UIneb3af1ki/lPMFreHNCVBXmr7CXwJEIt96uLsDWXRbMfAzqXP7mWSMJz+5q7fj5EhBHpuNwjZrOftRRKIBxgLrbtPZDQIaP/MQcwnTMzADdtoe50GnQjg2iResBLEF3eijCnrCtIoRKZyJ8TWXhb0kS1hKHj2FS0YpZEatumvkelXMs6msj0WJQ4C44HZ5Z8ad+tynWxHA7TSCrQ3ni99YJQSm80yI12hct+C6t3MRtX/G5G8tP/CL6XrUVt7IGnU7D6tA6Z5fX+xPV1ysQl3mxxTCU5kPFq0CNgzdJPxUxQ4VdhW+6PmVC4E5o36qjSc/O5OG7P8o4P0lQHASfQ6wWok7lIWvYz1dsDiwm5kjfEP4PzBu/V8XToBWST7k= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5534.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(39860400002)(136003)(366004)(396003)(346002)(376002)(76116006)(66446008)(26005)(8676002)(186003)(8936002)(38100700002)(6506007)(33656002)(478600001)(53546011)(52536014)(2906002)(316002)(5660300002)(86362001)(83380400001)(66476007)(71200400001)(7696005)(4326008)(55016002)(66946007)(66556008)(122000001)(64756008)(107886003)(9686003)(110136005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?EHrPCbWMDTKfi0UNOW+QslBRePnVMYAGf4gk+WPtXsYHzQKrs5S9rBUt7RoD?= =?us-ascii?Q?vEQCG0qUXXIh/6wySroF4uqnnYOgV7y1Ljr6P2CxDY0Kj/4/4UnndPEwz/1B?= =?us-ascii?Q?XXpW3R+D5zZKsxqsR+YFtaSrTsyr11EmijzCPwZo3vbfa3pfcMhRNf6wPFiO?= =?us-ascii?Q?VRbD0N9lA5z4uw90OISh1OpfE3ybO1t8eoDxif3M27QVpA3Mtj3wx2blRLuD?= =?us-ascii?Q?m6RCUsON4GQNCg7zNd3cGFX814t078nU5SG7JnvkLUVz9XLMYK6kI6Ue8VGb?= =?us-ascii?Q?nTG+ENCwyIZEBxhGT4OyF7uOSsnxeO3wOweJM0EgsHqSLmgQOQtOBx4a85PT?= =?us-ascii?Q?x0/SlwBB1F2sgKeStAKJDQASeRRBShLpr+COLezXw2fzx2XyUNZd3A6dAt2L?= =?us-ascii?Q?uniC9Y6B9gJEqAkT6NJHGqO0NB/XRAewym5mJfzSC7zcrFhKipUP1iQN8uOe?= =?us-ascii?Q?LFENmy+ZuQmprBJP6K3xaWBbdCgh1tln40LXrOZdQIDVGTBH6IfIPqBdIYQn?= =?us-ascii?Q?puq8uDeHdL62km2grVgnGnnaVNdi9TsWbk4WWUJjcp+j10+1SUT19itsuhGF?= =?us-ascii?Q?dUDQ6EDZFHVyU2aBmhvkOeoIRcConKxLuv2paEtQ9RPxTBjun/fjl55Jtyma?= =?us-ascii?Q?kyc/LVr5aFPi2npi2BXkUy0Uo/B0Fee4xGxUEpaMzB5r1q1tRrySJJkmJsBp?= =?us-ascii?Q?KvtRlcVsn8VaFTy1ev5GXa/TeTm+GSVvasQ5PkQsIqbRHTASnXk8aTB3n0kP?= =?us-ascii?Q?qhyRUP3h/HvL2Gio+MxQEIZp5czC7FrOyBN+j+unNIVPySa9ooJzqz2pjz2z?= =?us-ascii?Q?wIuBQ4GSNykIqVuEzb2MrXyzyV4DKZLSuYB830JqVO+b2RDJoek/1Sn+xmD/?= =?us-ascii?Q?YlE9oVV6maehNU+OhAIyJUlRc+aVJWrz2VcUlrL+f+Fg0pOBAoKbhZJrYLsT?= =?us-ascii?Q?KaT+M3XtXyNn4QnLlF5/g9slHXYdG+yLVce/jE8XvGlJhtfwUq2mFqO0hn/L?= =?us-ascii?Q?fHPFzlcyPVTncpUqH8tfzWW047UhfhTHtQq6Vz9cSgz53qgQvq2Jm9qWuTdO?= =?us-ascii?Q?YVkVmQzRp2nfq0b1KzrB6P2ZISR/7t1TPr4gu0abU/GtA3IdD7Z0JLWPDwSs?= =?us-ascii?Q?Te3zHmX5glMJUgsfIf8CWaU2LV0zmsuGQPzzld7oiynWHuFRjxo1RsG4Cwbp?= =?us-ascii?Q?Gd223vaCN1AhokWqvI8hOIY5ueGI3L6CoTOYzAMdtFjrkBFL5Qb+ZXL/woUl?= =?us-ascii?Q?5wg2iQOtdMew39F/AqgR3fbYrrGb3IIiWkyaeHpgAOodi+FKBokvBY0xfNZS?= =?us-ascii?Q?8Rd2jdQ2oV3sEX++8KaJTbSx?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5534.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b7ab4569-5bd6-4ec7-53da-08d90b86b82e X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Apr 2021 03:19:09.1659 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: c7X05tnxXnF26Aw/Fx7/dIortdtD7YMIZ30Vg93JP22aWuSIQwDEWqVejgFVLObeIYbtgC10hMGUh9sn9EDyzQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4475 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: add link speed check before port start 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 Sender: "dev" > -----Original Message----- > From: Min Hu (Connor) > Sent: Wednesday, April 28, 2021 16:37 > To: dev@dpdk.org > Cc: Yigit, Ferruh ; Li, Xiaoyun > Subject: [PATCH v2 1/2] app/testpmd: add link speed check before port sta= rt >=20 > From: Huisong Li >=20 > Currently, to check whether the configured link_speeds is valid, we have = to run > "port start". In addition, if the configuration fails, "port->dev_conf.li= nk_speeds" > maintained in testpmd cannot be restored. >=20 > This patch adds the link_speeds check before port start by calling dev_co= nfigure, > and resolves these problems. Not sure about this patch. I don't think you can fix the issue you mentione= d. Probably only hns3 does speed check in dev_configure. I don't see this in o= ther drivers, not in i40e/ice/mlx. I guess it's because if it's not supported speed, it will just be UNKNOWN a= nd user can config again? BTW, even if this behavior is accepted by others, still some comments below= . >=20 > Signed-off-by: Huisong Li > Signed-off-by: Min Hu (Connor) > --- > app/test-pmd/cmdline.c | 42 ++++++++++++++++++++++++++++++++++++++++- > - > 1 file changed, 40 insertions(+), 2 deletions(-) >=20 > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index > 5fdcc1c..ddbc629 100644 > --- a/app/test-pmd/cmdline.c > +++ b/app/test-pmd/cmdline.c > @@ -1549,8 +1549,12 @@ cmd_config_speed_all_parsed(void *parsed_result, > __rte_unused void *data) > { > struct cmd_config_speed_all *res =3D parsed_result; > + uint32_t old_link_speeds[RTE_MAX_ETHPORTS]; > + struct rte_port *port; > uint32_t link_speed; > portid_t pid; > + portid_t i; > + int ret; >=20 > if (!all_ports_stopped()) { > printf("Please stop all ports first\n"); @@ -1562,7 +1566,26 @@ > cmd_config_speed_all_parsed(void *parsed_result, > return; >=20 > RTE_ETH_FOREACH_DEV(pid) { > - ports[pid].dev_conf.link_speeds =3D link_speed; > + port =3D &ports[pid]; > + old_link_speeds[pid] =3D port->dev_conf.link_speeds; > + port->dev_conf.link_speeds =3D link_speed; > + ret =3D rte_eth_dev_configure(pid, nb_rxq, nb_txq, > + &port->dev_conf); > + if (ret < 0) { > + printf("Failed to check link speeds for port %d, ret > =3D %d.\n", > + pid, ret); > + goto roolback; Why don't you just add restoring all ports speed here and then "break"? No = matter one dev fails or not, all ports will do reconfig from your code logi= c. And you type rollback wrongly. > + } > + } > + > + cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); > + > + return; > + > +roolback: > + for (i =3D 0; i <=3D pid; i++) { > + port =3D &ports[i]; > + port->dev_conf.link_speeds =3D old_link_speeds[i]; > } >=20 > cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); @@ -1621,7 > +1644,10 @@ cmd_config_speed_specific_parsed(void *parsed_result, > __rte_unused void *data) > { > struct cmd_config_speed_specific *res =3D parsed_result; > + uint32_t old_link_speeds; > + struct rte_port *port; > uint32_t link_speed; > + int ret; >=20 > if (!all_ports_stopped()) { > printf("Please stop all ports first\n"); @@ -1635,8 +1661,20 @@ > cmd_config_speed_specific_parsed(void *parsed_result, > &link_speed) < 0) > return; >=20 > - ports[res->id].dev_conf.link_speeds =3D link_speed; > + port =3D &ports[res->id]; > + old_link_speeds =3D port->dev_conf.link_speeds; > + port->dev_conf.link_speeds =3D link_speed; > + ret =3D rte_eth_dev_configure(res->id, nb_rxq, nb_txq, > + &port->dev_conf); > + if (ret < 0) { > + printf("Failed to check link speeds for port %d, ret =3D %d.\n", > + res->id, ret); > + port->dev_conf.link_speeds =3D old_link_speeds; > + } >=20 > + /* > + * If the cmd fails to execute, it is necessary to reconfigure device. > + */ > cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); } >=20 > -- > 2.7.4