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 57D60A034F; Wed, 22 Dec 2021 01:54:12 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0630140040; Wed, 22 Dec 2021 01:54:11 +0100 (CET) Received: from VLXDG1SPAM1.ramaxel.com (email.unionmem.com [221.4.138.186]) by mails.dpdk.org (Postfix) with ESMTP id CEF674003C for ; Wed, 22 Dec 2021 01:54:09 +0100 (CET) Received: from V12DG1MBS01.ramaxel.local (v12dg1mbs01.ramaxel.local [172.26.18.31]) by VLXDG1SPAM1.ramaxel.com with ESMTPS id 1BM0s32B008121 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 22 Dec 2021 08:54:03 +0800 (GMT-8) (envelope-from songyl@ramaxel.com) Received: from localhost (172.20.2.155) by V12DG1MBS01.ramaxel.local (172.26.18.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Wed, 22 Dec 2021 08:54:02 +0800 Date: Wed, 22 Dec 2021 08:54:00 +0800 From: Yanling Song To: Stephen Hemminger CC: , , , , Subject: Re: [PATCH v1 01/25] drivers/net: introduce a new PMD driver Message-ID: <20211222085400.0000408c@ramaxel.com> In-Reply-To: <20211219114031.146a4c1e@hermes.local> References: <913359f582b165a3fcfe5efbd4dab76476690a53.1639636621.git.songyl@ramaxel.com> <20211219114031.146a4c1e@hermes.local> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.29; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [172.20.2.155] X-ClientProxiedBy: V12DG1MBS01.ramaxel.local (172.26.18.31) To V12DG1MBS01.ramaxel.local (172.26.18.31) X-DNSRBL: X-MAIL: VLXDG1SPAM1.ramaxel.com 1BM0s32B008121 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 On Sun, 19 Dec 2021 11:40:31 -0800 Stephen Hemminger wrote: > On Sat, 18 Dec 2021 10:51:28 +0800 > Yanling Song wrote: > > > +#ifdef CLOCK_MONOTONIC_RAW /* Defined in glibc bits/time.h */ > > +#define CLOCK_TYPE CLOCK_MONOTONIC_RAW > > +#else > > +#define CLOCK_TYPE CLOCK_MONOTONIC > > +#endif > > CLOCK_MONOTONIC_RAW was defined in Linux.2.6.28 > DPDK does not support any kernels that old, so the #ifdef is not > needed. > OK. #ifdef will be removed in the next version. > > + > +static inline unsigned long clock_gettime_ms(void) > +{ > + struct timespec tv; > + > + (void)clock_gettime(CLOCK_TYPE, &tv); > + > + return (unsigned long)tv.tv_sec * SPNIC_S_TO_MS_UNIT + > + (unsigned long)tv.tv_nsec / SPNIC_S_TO_NS_UNIT; > +} > > If all you want is jiffie accuracy, you could use > CLOCK_MONOTONIC_COARSE. > I did not get your point: CLOCK_MONOTONIC is more accurate than CLOCK_MONOTONIC_COARSE, right? > > +#define jiffies clock_gettime_ms() > +#define msecs_to_jiffies(ms) (ms) > > +#define time_before(now, end) ((now) < (end)) > > Does that simple version of the macro work right if jiffies wraps > around? Less of an issue on 64 bit platforms... > > The kernel version is effectively. > #define time_before(now, end) ((long)((now) - (end)) < 0) OK. Will be changed in the next version.