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 0D7C2A0C47; Tue, 12 Oct 2021 18:16:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DF3CB410DB; Tue, 12 Oct 2021 18:16:25 +0200 (CEST) Received: from new1-smtp.messagingengine.com (new1-smtp.messagingengine.com [66.111.4.221]) by mails.dpdk.org (Postfix) with ESMTP id EB6B4410DA for ; Tue, 12 Oct 2021 18:16:23 +0200 (CEST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 96994580ADF; Tue, 12 Oct 2021 12:16:23 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 12 Oct 2021 12:16:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=fm2; bh= 46/X5jwddqEoE+JwywLNQApa1CS0Rj6R6Jf41DJtANw=; b=ALTK4XrcXTO8F8nh g92sP8KTak6njKDjV0gaPYIB6edsWIe1bGrqQOD3oyvzEiRqaZeG0a6CunXOndYk W/xNrGMj3oG10u0jazsn1fwAChgbiKD1dmuTSonFOfh/isGJE0V2XVl8jQr0Z1bQ mLBK/UnNijAvHxub02XqfZPFqoh/c4k5HuS2irHmNoZ5KpfP08My1oX9I0kId4Zm L0ClFY01FVQYt8m4KlTxyqgNXhfIfGCKiAzQzMFKOZT/9Ik63BeBW2ipvzqzCNHN nk/1Js10HQTdqFsBCAhPt9/90y0W9c/YO3obo8xY3vNIEhDY0AyK4QBxSPeiSy/g 16RtDg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=46/X5jwddqEoE+JwywLNQApa1CS0Rj6R6Jf41DJtA Nw=; b=fAJ0U9qmVS1Irvy9+JzWJAmKnsi0kGAxpdXRG4dYUpwm/jpkTxD+7xlTE jlQh/x1GA+8zci09zT3Qr3CwPFA3cmZ7zXAqW5GNfK7KP5Iu4KCSUHGXfyzIObsq 3YZapvVYXUwG1tUrcQAKABzIpNawEzW2QurweEZzADRooL152kDLz1lCJ29J43lN Hd4lq4V0ENRpBHNfskSgU4tRfPLG2suGtqZK3xPjgBgmiqQsdmerjntZ4AezDtr1 Z0luLMgG5ZQqfv5AK9hj4CkgVuMNb/ClgartmXTwqaPHSwOSfMe9l0pYEtQ0d5Ls fmwatqQ7Vwau3Vzgk60rP1Sy/ri6g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddtkedgleehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepudeggfdvfeduffdtfeeglefghfeukefgfffhueejtdetuedtjeeu ieeivdffgeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 12 Oct 2021 12:16:20 -0400 (EDT) From: Thomas Monjalon To: Narcisa Ana Maria Vasile Cc: dev@dpdk.org, dmitry.kozliuk@gmail.com, khot@microsoft.com, navasile@microsoft.com, dmitrym@microsoft.com, roretzla@microsoft.com, talshn@nvidia.com, ocardona@microsoft.com, bruce.richardson@intel.com, david.marchand@redhat.com, pallavi.kadam@intel.com Date: Tue, 12 Oct 2021 18:16:19 +0200 Message-ID: <2707621.neF2WRQu8d@thomas> In-Reply-To: <1633765318-28356-4-git-send-email-navasile@linux.microsoft.com> References: <1633732841-17873-1-git-send-email-navasile@linux.microsoft.com> <1633765318-28356-1-git-send-email-navasile@linux.microsoft.com> <1633765318-28356-4-git-send-email-navasile@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v16 3/9] eal/windows: translate Windows errors to errno-style errors 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 Sender: "dev" 09/10/2021 09:41, Narcisa Ana Maria Vasile: > From: Narcisa Vasile > > Add function to translate Windows error codes to > errno-style error codes. The possible return values are chosen > so that we have as much semantical compatibility between platforms as > possible. > > Signed-off-by: Narcisa Vasile > --- > lib/eal/common/rte_thread.c | 6 +-- > lib/eal/include/rte_thread.h | 5 +- > lib/eal/windows/rte_thread.c | 95 +++++++++++++++++++++++++++--------- > 3 files changed, 76 insertions(+), 30 deletions(-) > > diff --git a/lib/eal/common/rte_thread.c b/lib/eal/common/rte_thread.c > index e1a4d7eae4..27ad1c7eb0 100644 > --- a/lib/eal/common/rte_thread.c > +++ b/lib/eal/common/rte_thread.c > @@ -47,7 +47,7 @@ rte_thread_attr_init(rte_thread_attr_t *attr) > > int > rte_thread_attr_set_affinity(rte_thread_attr_t *thread_attr, > - rte_cpuset_t *cpuset) > + rte_cpuset_t *cpuset) > { > RTE_VERIFY(thread_attr != NULL); > RTE_VERIFY(cpuset != NULL); > @@ -59,7 +59,7 @@ rte_thread_attr_set_affinity(rte_thread_attr_t *thread_attr, > > int > rte_thread_attr_get_affinity(rte_thread_attr_t *thread_attr, > - rte_cpuset_t *cpuset) > + rte_cpuset_t *cpuset) > { > RTE_VERIFY(thread_attr != NULL); > RTE_VERIFY(cpuset != NULL); > @@ -71,7 +71,7 @@ rte_thread_attr_get_affinity(rte_thread_attr_t *thread_attr, > > int > rte_thread_attr_set_priority(rte_thread_attr_t *thread_attr, > - enum rte_thread_priority priority) > + enum rte_thread_priority priority) Above are unrelated changes. > --- a/lib/eal/windows/rte_thread.c > +++ b/lib/eal/windows/rte_thread.c > @@ -13,6 +13,54 @@ struct eal_tls_key { > DWORD thread_index; > }; > > +/* Translates the most common error codes related to threads */ > +static int > +thread_translate_win32_error(DWORD error) So you decide to adopt POSIX error codes for the DPDK API. OK > +{ > + switch (error) { > + case ERROR_SUCCESS: > + return 0; > + > + case ERROR_INVALID_PARAMETER: > + return EINVAL; > + > + case ERROR_INVALID_HANDLE: > + return EFAULT; > + > + case ERROR_NOT_ENOUGH_MEMORY: > + /* FALLTHROUGH */ > + case ERROR_NO_SYSTEM_RESOURCES: > + return ENOMEM; > + > + case ERROR_PRIVILEGE_NOT_HELD: > + /* FALLTHROUGH */ > + case ERROR_ACCESS_DENIED: > + return EACCES; > + > + case ERROR_ALREADY_EXISTS: > + return EEXIST; > + > + case ERROR_POSSIBLE_DEADLOCK: > + return EDEADLK; > + > + case ERROR_INVALID_FUNCTION: > + /* FALLTHROUGH */ > + case ERROR_CALL_NOT_IMPLEMENTED: > + return ENOSYS; > + } > + > + return EINVAL; > +} [...] > rte_thread_key_create(rte_thread_key *key, > __rte_unused void (*destructor)(void *)) > { > + int ret; > + > *key = malloc(sizeof(**key)); > if ((*key) == NULL) { > RTE_LOG(DEBUG, EAL, "Cannot allocate TLS key.\n"); > - rte_errno = ENOMEM; > - return -1; > + return ENOMEM; > } Why this change? rte_errno and negative error code are good.