From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0054.outbound.protection.outlook.com [104.47.1.54]) by dpdk.org (Postfix) with ESMTP id 888321200A for ; Wed, 24 Jan 2018 12:42:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=hZ6BOK318PBymbD0MsngIa6x5vr6uoATA2E7V38QWDg=; b=KAXLzeK9UOyyi9Hqm42YYCuHr5EoKCUPRR25zdGf7FqJGtdQ6uFWZiKvYTBGsQtfEJ5pelJNuZhGWZF+H7fDZBF7iCgwDjqLvtUrvJZQI63fkGsxbE/LW3AoGWfIFNJuIiAyOXAObUxX3jtT7uVPSWROiMvzTdXkpsFbx2jK9eo= Received: from AM4PR05MB1476.eurprd05.prod.outlook.com (10.164.79.142) by AM4PR05MB1747.eurprd05.prod.outlook.com (10.165.246.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Wed, 24 Jan 2018 11:42:45 +0000 Received: from AM4PR05MB1476.eurprd05.prod.outlook.com ([fe80::951d:79c9:7763:1603]) by AM4PR05MB1476.eurprd05.prod.outlook.com ([fe80::951d:79c9:7763:1603%13]) with mapi id 15.20.0428.023; Wed, 24 Jan 2018 11:42:45 +0000 From: Ori Kam To: Beilei Xing CC: "dev@dpdk.org" Thread-Topic: [PATCH v3] examples/flow_filtering: add delay during updating link status Thread-Index: AQHTlPwyWZm9jgqXUEu5UQqovmfIlKOC5hVw Date: Wed, 24 Jan 2018 11:42:45 +0000 Message-ID: References: <1516782880-59883-1-git-send-email-beilei.xing@intel.com> <1516788934-66399-1-git-send-email-beilei.xing@intel.com> In-Reply-To: <1516788934-66399-1-git-send-email-beilei.xing@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=orika@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM4PR05MB1747; 7:SrVYojzPwV/nrAHMng3wvhTH87IpBD2EG0LICrK3YDL3m5JgGgLSFAFj1LZtJvXZadxgHvsdSl/7R6pOTRl2iqdwQ3PuFJrD7bNrSBNk+Oq/E3RbxKww9VFXunEd5CbQQBMdkLGodf4yt1v92QVA9jt2zN+OKBqym8RqmzIoXExLpW8q0FVb5xs0UpbH8YHk1KcXE03QtMS57oMOlVwq7rYW39H7ef6dFoYzB5/BCfCYSzUczGOPg70WalqQ3MNp x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 821758d1-865e-4912-a826-08d5631f9616 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(48565401081)(2017052603307)(7153060)(7193020); SRVR:AM4PR05MB1747; x-ms-traffictypediagnostic: AM4PR05MB1747: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(278428928389397)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(10201501046)(3231023)(2400081)(944501161)(3002001)(93006095)(93001095)(6055026)(6041288)(20161123564045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011); SRVR:AM4PR05MB1747; BCL:0; PCL:0; RULEID:; SRVR:AM4PR05MB1747; x-forefront-prvs: 056297E276 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(39860400002)(366004)(376002)(39380400002)(396003)(199004)(13464003)(189003)(59450400001)(3280700002)(305945005)(8936002)(81166006)(81156014)(7696005)(8676002)(5250100002)(9686003)(86362001)(76176011)(316002)(575784001)(2906002)(102836004)(25786009)(4326008)(5660300001)(2900100001)(7736002)(6246003)(53546011)(6506007)(2950100002)(105586002)(3846002)(6116002)(26005)(229853002)(14454004)(33656002)(68736007)(6436002)(74316002)(97736004)(478600001)(55016002)(66066001)(6916009)(106356001)(53936002)(3660700001)(99286004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB1747; H:AM4PR05MB1476.eurprd05.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: S67nZZ7P4Hvdvg2nHIOL0SF+AieXtd/E3uvqf9EqT++ZTix4n3N4nFtxiUP5oi00Y1XZDonVySK+qkw4pPICkA== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 821758d1-865e-4912-a826-08d5631f9616 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jan 2018 11:42:45.5058 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB1747 Subject: Re: [dpdk-dev] [PATCH v3] examples/flow_filtering: add delay during updating link status 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: , X-List-Received-Date: Wed, 24 Jan 2018 11:42:47 -0000 > -----Original Message----- > From: Beilei Xing [mailto:beilei.xing@intel.com] > Sent: Wednesday, January 24, 2018 12:16 PM > To: Ori Kam > Cc: dev@dpdk.org > Subject: [PATCH v3] examples/flow_filtering: add delay during updating li= nk > status >=20 > Add up to 9s delay for getting link status to make sure NIC updates > link status successfully, just like other applications such as > testpmd and l2fwd. >=20 > Signed-off-by: Beilei Xing > --- > v3 changes: > - Modify MAX_REPEAT_TIME with MAX_REPEAT_TIMES > v2 changes: > - Add rte_delay_ms(CHECK_INTERVAL) which is missed in v1. >=20 > examples/flow_filtering/main.c | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) >=20 > diff --git a/examples/flow_filtering/main.c b/examples/flow_filtering/mai= n.c > index 4a07b63..d16a0a5 100644 > --- a/examples/flow_filtering/main.c > +++ b/examples/flow_filtering/main.c > @@ -55,6 +55,7 @@ > #include > #include > #include > +#include >=20 > static volatile bool force_quit; >=20 > @@ -119,13 +120,23 @@ main_loop(void) > rte_eth_dev_close(port_id); > } >=20 > +#define CHECK_INTERVAL 1000 /* 100ms */ > +#define MAX_REPEAT_TIMES 90 /* 9s (90 * 100ms) in total */ > + > static void > assert_link_status(void) > { > struct rte_eth_link link; > + uint8_t rep_cnt =3D MAX_REPEAT_TIMES; >=20 > memset(&link, 0, sizeof(link)); > - rte_eth_link_get(port_id, &link); > + do { > + rte_eth_link_get(port_id, &link); > + if (link.link_status =3D=3D ETH_LINK_UP) > + break; > + rte_delay_ms(CHECK_INTERVAL); > + } while (--rep_cnt); > + > if (link.link_status =3D=3D ETH_LINK_DOWN) > rte_exit(EXIT_FAILURE, ":: error: link is still down\n"); > } > -- > 2.5.5 Acked-by: Ori Kam Thanks, Ori