From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v5 2/7] net: Add common PTP structures and functions Date: Tue, 10 Nov 2015 12:25:35 +0100 Message-ID: <3105785.kBVynf3MPa@xps13> References: <1443799208-9408-1-git-send-email-danielx.t.mrzyglod@intel.com> <1446732366-10044-1-git-send-email-danielx.t.mrzyglod@intel.com> <1446732366-10044-3-git-send-email-danielx.t.mrzyglod@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org To: Daniel Mrzyglod Return-path: Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com [74.125.82.41]) by dpdk.org (Postfix) with ESMTP id 61EFD5957 for ; Tue, 10 Nov 2015 12:26:47 +0100 (CET) Received: by wmww144 with SMTP id w144so113202409wmw.1 for ; Tue, 10 Nov 2015 03:26:47 -0800 (PST) In-Reply-To: <1446732366-10044-3-git-send-email-danielx.t.mrzyglod@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 2015-11-05 15:06, Daniel Mrzyglod: > This patch add common functions and structures used for PTP processing. > > Signed-off-by: Daniel Mrzyglod > --- > lib/librte_net/Makefile | 2 +- > lib/librte_net/rte_ptp.h | 105 +++++++++++++++++++++++++++++++++++++++++++++++ The library librte_net gather some structures and functions for network headers/layers parsing. These PTP functions looks really generic. Why not add them in EAL? Maybe they could benefit from specific implementations in the arch/ directory. > +/* > + * Structure for cyclecounter IEEE1588 functionality. > + */ > +struct cyclecounter { > + uint64_t (*read)(struct rte_eth_dev *dev); This field is not used. Please avoid using a reference to ethdev here. > + uint64_t mask; > + uint32_t shift; > +}; > + > +/* > + * Structure to hold and calculate Unix epoch time. > + */ > +struct timecounter { > + struct cyclecounter *cc; > + uint64_t cycle_last; > + uint64_t nsec; > + uint64_t mask; > + uint64_t frac; > +}; This structure is not used. It is not clear what these structures are for, and what means each field. When adding a new field in an API, it must be commented in doxygen. > +static inline uint64_t > +timespec_to_ns(const struct timespec *ts) [...] > +static inline struct timespec > +ns_to_timespec(uint64_t nsec) [...] > +static inline uint64_t > +cyclecounter_cycles_to_ns(const struct cyclecounter *cc, > + uint64_t cycles, uint64_t mask, uint64_t *frac) [...] > +static inline uint64_t > +cyclecounter_cycles_to_ns_backwards(const struct cyclecounter *cc, > + uint64_t cycles, uint64_t frac) They must be prefixed with rte_ with full doxygen comments.