From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00059.outbound.protection.outlook.com [40.107.0.59]) by dpdk.org (Postfix) with ESMTP id B74011B19 for ; Wed, 24 Jan 2018 09:16:48 +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=lQtDT8exb2ktxzkTmLKLfVtL9lQuQHCKMWmhkKAH1mg=; b=pavnOD/lmtA2MZc+M0a38HltANwPMEvOpJnBXa+4ebQ1qxCJpKTKd2GNasmEBeV44vMP0rx5J1aPDc10dtMm1w0icvcU6EIbAJpg7ij7vS28CLHsA3FlbvugtbndqoPnJA9hEvDyyFjPstaPFUeLEzQpj0Q8mcqw4g5EDY2s55I= Received: from AM4PR05MB1476.eurprd05.prod.outlook.com (10.164.79.142) by AM4PR05MB1779.eurprd05.prod.outlook.com (10.165.246.138) 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 08:16:46 +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 08:16:46 +0000 From: Ori Kam To: Beilei Xing CC: "dev@dpdk.org" Thread-Topic: [PATCH] examples/flow_filtering: add delay during updating link status Thread-Index: AQHTlOg7RbRYaD89ykKo47iJ640zDKOCrKgw Date: Wed, 24 Jan 2018 08:16:46 +0000 Message-ID: References: <1516780359-57421-1-git-send-email-beilei.xing@intel.com> In-Reply-To: <1516780359-57421-1-git-send-email-beilei.xing@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM4PR05MB1779; 7:5+XL02ftbdpwO81cDpku/q4j6QUMHRZNjB08gPgjTRkvB+KJOX0pJ4CJZ6GoilS5ZnYChqZt31WjXbKgGMU+JNjy2BxyF/i7nB1jbz42h6JJ7P5eN+fF4atgNPXM8oc9G7crRnbBnSPPqrnHSEKQXKW2VCKY9fhrqJRTSF+38RfzjnPCGrQAdNHKzF9bAh1uV5LWGS/BpDfA50b369T3vYJ/qGhfS8OTqF/Uu+zEOpWacd7n41tZWJw45vQmXAG9 x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: e298593d-dce3-4c82-5357-08d56302cfaa 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:AM4PR05MB1779; x-ms-traffictypediagnostic: AM4PR05MB1779: 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)(93006095)(93001095)(10201501046)(3231023)(2400081)(944501161)(3002001)(6055026)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(6072148)(201708071742011); SRVR:AM4PR05MB1779; BCL:0; PCL:0; RULEID:; SRVR:AM4PR05MB1779; x-forefront-prvs: 056297E276 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(376002)(346002)(396003)(366004)(39380400002)(199004)(189003)(13464003)(4326008)(6916009)(2950100002)(105586002)(74316002)(316002)(5250100002)(106356001)(25786009)(305945005)(7736002)(9686003)(53546011)(6116002)(7696005)(26005)(76176011)(5660300001)(478600001)(6246003)(6436002)(59450400001)(3846002)(6506007)(8936002)(2900100001)(81156014)(8676002)(81166006)(6346003)(229853002)(66066001)(86362001)(68736007)(2906002)(14454004)(33656002)(97736004)(55016002)(3280700002)(99286004)(53936002)(102836004)(3660700001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB1779; 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) authentication-results: spf=none (sender IP is ) smtp.mailfrom=orika@mellanox.com; x-microsoft-antispam-message-info: X3R4ylX5aqERfvYkATvp8ev7qbRvkD6bpUK9nIm/lH81SChnY7liw/VCzfgLCdI6591fCAfThMC25Fhl2hIRoA== 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: e298593d-dce3-4c82-5357-08d56302cfaa X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jan 2018 08:16:46.7298 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB1779 Subject: Re: [dpdk-dev] [PATCH] 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 08:16:48 -0000 Hi Beilei, PSB > -----Original Message----- > From: Beilei Xing [mailto:beilei.xing@intel.com] > Sent: Wednesday, January 24, 2018 9:53 AM > To: Ori Kam > Cc: dev@dpdk.org > Subject: [PATCH] examples/flow_filtering: add delay during updating link > 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 > --- > examples/flow_filtering/main.c | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) >=20 > diff --git a/examples/flow_filtering/main.c b/examples/flow_filtering/mai= n.c > index 4a07b63..1788f24 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,22 @@ main_loop(void) > rte_eth_dev_close(port_id); > } >=20 > +#define CHECK_INTERVAL 1000 /* 100ms */ This define is not used. > +#define MAX_REPEAT_TIME 90 /* 9s (90 * 100ms) in total */ > + > static void > assert_link_status(void) > { > struct rte_eth_link link; > + uint8_t rep_cnt =3D MAX_REPEAT_TIME; >=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; > + } while (--rep_cnt); I think you are missing the rte_delay_ms(CHECK_INTERVAL); Currently the code will work for 90 iterations but we can't grantee the du= ration. > + > if (link.link_status =3D=3D ETH_LINK_DOWN) > rte_exit(EXIT_FAILURE, ":: error: link is still down\n"); } > -- > 2.5.5 Regards, Ori