From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f54.google.com (mail-wm0-f54.google.com [74.125.82.54]) by dpdk.org (Postfix) with ESMTP id B46669E3 for ; Tue, 19 Jul 2016 15:21:13 +0200 (CEST) Received: by mail-wm0-f54.google.com with SMTP id q128so19201131wma.1 for ; Tue, 19 Jul 2016 06:21:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:user-agent:in-reply-to :references:mime-version:content-transfer-encoding; bh=vH3bULRmFZdw6xoO4c7keQVjiSBpbAubINJsKasBtuU=; b=lh5ejfhD3BenfH0k64XVX5u7LiBy1ijvU5vJBMc0XyR+2UAUwkyFm1AihIVWG8/L0o 6QSYXdcYazwff/NRQNPtNAhkQrP+9+1KFkZr0jd9sMOuBZz1UAxX9x96YBg1a37MnTa2 4zC49Ofgbrs2VvrPmnoFuAQFGd7EPY2D41oFxQVH6wqvoAmXNsKGOi+YNkKBtSCokJ35 LXDYv4NiESQSXmGA2NV2c7yIPzWsUWBJddjUgPOiMFQQchNB/8T5nTGLGPTgHgjGGNJz 9MSowHlJ9AnGpYyA5VVgv7RxFGSjNQKysWNTcEG3LNsn3GKj052V5ISqxTmaNBjLDUVv 1zQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:user-agent :in-reply-to:references:mime-version:content-transfer-encoding; bh=vH3bULRmFZdw6xoO4c7keQVjiSBpbAubINJsKasBtuU=; b=kmlVNBQSG3rw75JqAkcNbZEmPWY5BVAlbb62pNAJDs8IrsIyYU0y2SD/cXo6KSH7DH QKJxnn/fJuSx8j8QmHcjR842wbChBIz9a8wj/qb5lSLb64cr5MCMjQDvEnqYrmYPh0tQ 8tNGD6x3Yi0vYtuwU2u3VyhPvkWc3Di2+Yv2mZlxl69HIWEAiYHWkeAxTZC3yw/TFaZw U1Sao+LYdNamSoiFFqFP/uWJytypvc823Ifb8AKYAqzfAwiZH70jOQY5p3d3xhD6AVHE 0Bic2HpVJaNC3YnjuVyP3M+zCfpooF0Daz6VEweCEou08OSd9kDOVIleZPf+0OPBR9lN sgaw== X-Gm-Message-State: ALyK8tJeF7PDacHAwvRoRSmk3DzfDKZVOJl/kZ9RwIseixTMzS73cKl1UU4XjcNce/0gqXq+ X-Received: by 10.28.182.136 with SMTP id g130mr4194870wmf.21.1468934473430; Tue, 19 Jul 2016 06:21:13 -0700 (PDT) Received: from xps13.localnet (184.203.134.77.rev.sfr.net. [77.134.203.184]) by smtp.gmail.com with ESMTPSA id c139sm22945321wme.4.2016.07.19.06.21.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Jul 2016 06:21:12 -0700 (PDT) From: Thomas Monjalon To: jozmarti@cisco.com Cc: dev@dpdk.org Date: Tue, 19 Jul 2016 15:21:11 +0200 Message-ID: <81613915.CvR5looQMP@xps13> User-Agent: KMail/4.14.10 (Linux/4.5.4-1-ARCH; KDE/4.14.11; x86_64; ; ) In-Reply-To: <1468932143-9321-1-git-send-email-jozmarti@cisco.com> References: <1468932143-9321-1-git-send-email-jozmarti@cisco.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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: Tue, 19 Jul 2016 13:21:13 -0000 Hi, 2016-07-19 14:42, jozmarti@cisco.com: > when running single-core, some drivers tend to call rte_delay_us for a > long time, and that is causing packet drops. > Attached patch introduces 2 new functions: > > void rte_delay_us_callback_register(void(*userfunc)(unsigned)); > void rte_delay_us_callback_unregister(void); > > First one replaces rte_delay_us with userfunc and second one restores > original rte_delay_us. I think we could avoid the function unregister by exporting the default implementation (let's say rte_delay_us_block). > +REGISTER_TEST_COMMAND(user_delay_us, test_user_delay_us); Thanks for providing an unit test. > --- a/lib/librte_eal/common/eal_common_timer.c > +++ b/lib/librte_eal/common/eal_common_timer.c > void > rte_delay_us(unsigned us) > { > + if (unlikely(rte_delay_us_override != NULL)) > + { > + rte_delay_us_override(us); > + return; > + } Why not always call the registered callback and initialize it to the default implementation (maybe using a constructor)?