From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0077.outbound.protection.outlook.com [104.47.0.77]) by dpdk.org (Postfix) with ESMTP id 3A2CAA568 for ; Wed, 24 Jan 2018 09:55:32 +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=7PVnxZTzZJBYvUpcYXGKffBUP9moCEJAiHwFvugXh8I=; b=kZH0BcLoKHXYL8CFHxvu87Yj5pxTNZL9EphwuBUdZm61wc3pkJU486gN7O3bJDS7CguILs0Kph1D+ncsFsMAEB3OWVpE5s72jKhlG72lCPfAzeKsrQbzTiJ2mtfUMgs9BqGb5wDS2Ezz2snBVpDr/uoEhWtbODwMjrOmT3xXiA0= Received: from AM4PR05MB1476.eurprd05.prod.outlook.com (10.164.79.142) by AM4PR05MB3506.eurprd05.prod.outlook.com (10.171.188.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Wed, 24 Jan 2018 08:55:30 +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:55:30 +0000 From: Ori Kam To: Beilei Xing CC: "dev@dpdk.org" Thread-Topic: [PATCH v2] examples/flow_filtering: add delay during updating link status Thread-Index: AQHTlO4mF7ZcVRZ6+Uqk9VQPe9ZuEaOCtszg Date: Wed, 24 Jan 2018 08:55:30 +0000 Message-ID: References: <1516780359-57421-1-git-send-email-beilei.xing@intel.com> <1516782880-59883-1-git-send-email-beilei.xing@intel.com> In-Reply-To: <1516782880-59883-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; AM4PR05MB3506; 7:G72Syc/m/gzLyMx9dRAgS6tbYpakXEo7ft6C3vddlqLIR3wW7sVO4BPnnsu1Gi+AiikO2AA6SF2AImJRIqcH+H/B/g9LaHfq2XMPcqDHIti6sPOPys49PBidd2pw61N8YoX/bSZhFpczjYHNOzmM/2x73iXwMui+0uabpUWYgY8kLLN7zGrylgsNwqZOZzuxc2w8puXPffLFG/HihFyUqEAAWe5v/PsM5nVZ18k5oTGj1XUiC0nXBK9UBsjQcOK8 x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 04c01649-4891-40d8-d63a-08d5630838a7 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(3008032)(2017052603307)(7153060)(7193020); SRVR:AM4PR05MB3506; x-ms-traffictypediagnostic: AM4PR05MB3506: 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)(5005006)(8121501046)(3231023)(2400081)(944501161)(10201501046)(93006095)(93001095)(3002001)(6055026)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123564045)(20161123562045)(6072148)(201708071742011); SRVR:AM4PR05MB3506; BCL:0; PCL:0; RULEID:; SRVR:AM4PR05MB3506; x-forefront-prvs: 056297E276 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(39380400002)(376002)(366004)(39860400002)(346002)(13464003)(76104003)(189003)(199004)(74316002)(106356001)(86362001)(8936002)(66066001)(5660300001)(3280700002)(81156014)(81166006)(3660700001)(68736007)(8676002)(7696005)(9686003)(102836004)(6436002)(76176011)(4326008)(53936002)(6506007)(55016002)(6246003)(229853002)(59450400001)(26005)(25786009)(53546011)(99286004)(3846002)(6116002)(478600001)(5250100002)(2906002)(14454004)(97736004)(33656002)(6916009)(2950100002)(7736002)(2900100001)(316002)(105586002)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3506; H:AM4PR05MB1476.eurprd05.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: Ai0m/oGkkqIQ7f96s0T3yUe3zUxQXBQFlNsIXGCbTQaT+CatZOhinLmzYEWLrWIM1azVcOLkzcNoQczKtBNTDw== 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: 04c01649-4891-40d8-d63a-08d5630838a7 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jan 2018 08:55:30.3111 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3506 Subject: Re: [dpdk-dev] [PATCH v2] 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:55:32 -0000 Hi > -----Original Message----- > From: Beilei Xing [mailto:beilei.xing@intel.com] > Sent: Wednesday, January 24, 2018 10:35 AM > To: Ori Kam > Cc: dev@dpdk.org > Subject: [PATCH v2] 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 > --- >=20 > 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..85d5727 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_TIME 90 /* 9s (90 * 100ms) in total */ I know that in other examples there is use of=20 MAX_REPEAT_TIME but don't you think the name is incorrect, It should be called: MAX_REPEAT_TIMES or MAX_REPEAT_COUNT? Since it doesn't represent time but iterations. What do you think? > + > 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; > + 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