From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from alln-iport-8.cisco.com (alln-iport-8.cisco.com [173.37.142.95]) by dpdk.org (Postfix) with ESMTP id CE69F5688 for ; Thu, 22 Sep 2016 10:37:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=3966; q=dns/txt; s=iport; t=1474533465; x=1475743065; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=KjSGvsFl4K0ws/TWd+99NtbjymDSm2rwgO3rNNVo0QE=; b=YXFCnzqW40Nbu1zP9i+hVqQ5qx8JHE3zFGbSORfGc1g82wNFoyaC7rgT QnJtgVpxcQ5FOgidoP+Q5UhPtr/HTqVRSUpb9mnE1/oB37r4K79qoIm1i ofbVKDZiI7pnau47ruVPtbOOdcgkXJAlH8SQv5pTPObACX10OVJx30aQf w=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0AhAQCQl+NX/51dJa1eGQEBAQEBAQEBA?= =?us-ascii?q?QEBBwEBAQEBgzsBAQEBAR5XfAeNLKk1gg+CBCiFdgKBZjgUAQIBAQEBAQEBXie?= =?us-ascii?q?EYQEBAQMBJxM/BQcEAgEIEQQBAR8JBx8TFAkIAgQOBQiIOwgOuz4BAQEBAQEBA?= =?us-ascii?q?QEBAQEBAQEBAQEBAQEciwuEFhEBhXoFlB6FVwEZhg2DBIYzgXVOhBaJGkiMIIN?= =?us-ascii?q?7AR42GoJ/HIFQcgGFO4EgfwEBAQ?= X-IronPort-AV: E=Sophos;i="5.30,378,1470700800"; d="scan'208";a="326549499" Received: from rcdn-core-6.cisco.com ([173.37.93.157]) by alln-iport-8.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Sep 2016 08:37:44 +0000 Received: from XCH-RCD-016.cisco.com (xch-rcd-016.cisco.com [173.37.102.26]) by rcdn-core-6.cisco.com (8.14.5/8.14.5) with ESMTP id u8M8biD1027096 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Thu, 22 Sep 2016 08:37:44 GMT Received: from xch-rcd-019.cisco.com (173.37.102.29) by XCH-RCD-016.cisco.com (173.37.102.26) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Thu, 22 Sep 2016 03:37:43 -0500 Received: from xch-rcd-019.cisco.com ([173.37.102.29]) by XCH-RCD-019.cisco.com ([173.37.102.29]) with mapi id 15.00.1210.000; Thu, 22 Sep 2016 03:37:43 -0500 From: "Jozef Martiniak -X (jozmarti - PANTHEON TECHNOLOGIES at Cisco)" To: Thomas Monjalon CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] rte_delay_us can be replaced with user function Thread-Index: AQHR4n/GznH5Ik7xkkW7dnBb+2zFO6B4gu4AgAwfoYCAAO8cUA== Date: Thu, 22 Sep 2016 08:37:43 +0000 Message-ID: <3d62cdb3b19648d8a4ed7e0ff4847db5@XCH-RCD-019.cisco.com> References: <1469016644-6521-1-git-send-email-jozmarti@cisco.com> <8519806.gZT5cxUFJR@xps13> <2644416.cGCtye7R7u@xps13> In-Reply-To: <2644416.cGCtye7R7u@xps13> Accept-Language: en-US, sk-SK Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.61.226.106] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] rte_delay_us can be replaced with user function X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2016 08:37:46 -0000 Hello Thomas, > First a general comment: please check your patch with scripts/checkpatche= s.sh. > Done. checkpath.pl is taken from latest linux kernel... > What will happen if we need to provide more builtin handlers? > I still think that rte_delay_us_block can be exported and initialized The idea was to make this function simple&&fast as possible. If user needs more builtin handlers - he can implement this functionality within his dela= y=20 function. Btw there is also another patch with the same functionality (uses weak symb= ols)=20 which I would prefer: https://git.fd.io/cgit/vpp/tree/dpdk/dpdk-16.04_patches/0005-Allow-applicat= ions-to-override-rte_delay_us.patch Do you have any idea how should rte_delay_us_callback_register look like fo= r=20 multiple handlers ? Other comments are accepted. Best regards, Jozef -----Original Message----- From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]=20 Sent: Wednesday, September 21, 2016 3:13 PM To: Jozef Martiniak -X (jozmarti - PANTHEON TECHNOLOGIES at Cisco) Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH] rte_delay_us can be replaced with user func= tion Hi, I think this feature should enter in the release 16.11. We just need to make sure it is implemented with the right API. Do you have any comment about managing several builtin handlers? 2016-09-13 22:04, Thomas Monjalon: > Hi, >=20 > Sorry for late review. > This patch was in a summer hole :/ >=20 > First a general comment: please check your patch with=20 > scripts/checkpatches.sh. > In order to ease tracking of this patch, please increment the version=20 > when sending a new one in the same thread: > git send-email -1 -v3 --annotate --to dev@dpdk.org \ > --in-reply-to 1469016644-6521-1-git-send-email-jozmarti@cisco.com >=20 > More comments below. >=20 > 2016-07-20 14:10, jozmarti@cisco.com: > > +void rte_delay_us_callback_register(void (*userfunc)(unsigned)) { > > + if (userfunc =3D=3D NULL) > > + rte_delay_us =3D rte_delay_us_block; >=20 > Here you are creating an exception for rte_delay_us_block which is=20 > mapped as a NULL handler. > What will happen if we need to provide more builtin handlers? > I still think that rte_delay_us_block can be exported and initialized=20 > as the default handler. Other opinions are obviously welcome. >=20 > > + else > > + rte_delay_us =3D userfunc; > > +} > > + > > +static void __attribute__((constructor)) > > +rte_timer_init(void) > > +{ > > + /* set rte_delay_us_block as a delay function */ > > + rte_delay_us_callback_register(NULL); > > +} > > diff --git a/lib/librte_eal/common/include/generic/rte_cycles.h=20 > > b/lib/librte_eal/common/include/generic/rte_cycles.h > > index 8cc21f2..7a45b58 100644 > > --- a/lib/librte_eal/common/include/generic/rte_cycles.h > > +++ b/lib/librte_eal/common/include/generic/rte_cycles.h > > @@ -182,13 +182,16 @@ rte_get_timer_hz(void) } > > =20 > > /** > > + * >=20 > useless newline >=20 > > * Wait at least us microseconds. > > + * This function can be replaced with user-defined function using > > + * rte_delay_us_callback_register >=20 > I think you can use @see to point to rte_delay_us_callback_register. >=20 > > * > > * @param us > > * The number of microseconds to wait. > > */ > > void > > -rte_delay_us(unsigned us); > > +(*rte_delay_us)(unsigned us); > > =20 > > /** > > * Wait at least ms milliseconds. > > @@ -202,4 +205,14 @@ rte_delay_ms(unsigned ms) > > rte_delay_us(ms * 1000); > > } > > =20 > > +/** > > + * Replace rte_delay_us with user defined function. > > + * > > + * @param userfunc > > + * User function which replaces rte_delay_us. NULL restores > > + * buildin block delay function. >=20 > buildin -> builtin ? >=20 > > + */ > > +void rte_delay_us_callback_register(void(*userfunc)(unsigned)); >=20