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 2E269A0A0E; Thu, 29 Apr 2021 02:50:34 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1598A410FB; Thu, 29 Apr 2021 02:50:34 +0200 (CEST) Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) by mails.dpdk.org (Postfix) with ESMTP id BEFB840697 for ; Thu, 29 Apr 2021 02:50:32 +0200 (CEST) Received: by mail-lj1-f176.google.com with SMTP id u20so74393017lja.13 for ; Wed, 28 Apr 2021 17:50:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Lt/zB9EIJmxWk/PyXELu3tXnwwmP9gk9/EvfVv8VmCg=; b=REOLKiZVv/f13qO7r6KZSv3pv9q1WB0qM+ZCk2ra85PjAV9XhK0B+s/ndCWqlaJloJ /OAsYL3w6IWahpzxYHPuTMyREq1+mSgv4JAEBOpY+u4JbaWoW3+o6GRci0H1sf0usndH T1Fovxt1hvpCjapRlNWb93TZe00dGk0NmZIjMbzOSOwGgbdAdTMMnkylOGg9W5RFc4Eq 3AgIP+eoW03mNsXXX1tDwqvSvlPloC857NRN1EO1JMiHuBiSRFD8GK5rNRi8OJXZN1Ew X/Byp56bg2b7j4zykSJzLwNOmj+oqLIOLDwplujRgpjCbkVaegL8sDKYgvv5HoJ1r+dG ZYDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Lt/zB9EIJmxWk/PyXELu3tXnwwmP9gk9/EvfVv8VmCg=; b=RRoGWC9ILRKji26Zl3MdJVNkZfDrClC5hieCKObvSj+6/QalG+RRE8myjT/N9Lxj3c 2dBE9YN2UHkhZ9q7iMaWNzW6dwcFGtNGVOFoBil77xW432dflyy+F3wYoqhf0reQ7nO9 Me3kWQDzGq3ARlwgZR0zKIc/LbTimx8io3bCkP6nf02t85+601guQO5g/DHj9W8y1f9l vUsV1DHnsPvOuKVQxe3yUxsh70e6/VNHE5mLc7AiVRS/DY9d495anYth9R0g2WBhrApM BouXZ4Ry8zGTReH2Gc1LGteGEV0VHz4tEM4IeHLcmeqH6Yv90hgklqVBihwgT1DuTUZf v0sQ== X-Gm-Message-State: AOAM53317Mvm1OFSbZ3wElHQ4hHlhgP5P+NNfUib6QRXFtSElkbNiF/u UyEqGBC2FeN8nJ+qI2lqIYk= X-Google-Smtp-Source: ABdhPJzAA2A76rD7t+bnyLP+WsvP2IwM/nnvR+yf5VqoN8atEp41JwAACmYN168SQ8S34GHiY56fIg== X-Received: by 2002:a05:651c:1244:: with SMTP id h4mr22725924ljh.410.1619657432363; Wed, 28 Apr 2021 17:50:32 -0700 (PDT) Received: from sovereign (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id f39sm330770lfv.44.2021.04.28.17.50.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 17:50:31 -0700 (PDT) Date: Thu, 29 Apr 2021 03:50:29 +0300 From: Dmitry Kozlyuk To: Narcisa Ana Maria Vasile Cc: dev@dpdk.org, thomas@monjalon.net, 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 Message-ID: <20210429035029.349d3306@sovereign> In-Reply-To: <1617413948-10504-2-git-send-email-navasile@linux.microsoft.com> References: <1617057640-24301-2-git-send-email-navasile@linux.microsoft.com> <1617413948-10504-1-git-send-email-navasile@linux.microsoft.com> <1617413948-10504-2-git-send-email-navasile@linux.microsoft.com> X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v6 01/10] eal: add thread id and simple thread functions 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" 2021-04-02 18:38 (UTC-0700), Narcisa Ana Maria Vasile: > From: Narcisa Vasile > > Add the thread identifier type. > Add functions for comparing thread ids and obtaining the thread id > for the current thread. > > Signed-off-by: Narcisa Vasile > --- (For the whole series.) Please summarize and distribute relevant parts of the cover letter to commit messages. Remember that cover letter doesn't get to commit log. This series has subtle details that a good commit message should describe. > diff --git a/lib/librte_eal/include/rte_thread_types.h b/lib/librte_eal/include/rte_thread_types.h > new file mode 100644 > index 000000000..19fb85e38 > --- /dev/null > +++ b/lib/librte_eal/include/rte_thread_types.h > @@ -0,0 +1,12 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2021 Microsoft Corporation > + */ > + > +#ifndef _RTE_THREAD_TYPES_H_ > +#define _RTE_THREAD_TYPES_H_ > + > +#include > + > +typedef pthread_t rte_thread_t; > + > +#endif /* _RTE_THREAD_TYPES_H_ */ > diff --git a/lib/librte_eal/windows/include/rte_windows_thread_types.h b/lib/librte_eal/windows/include/rte_windows_thread_types.h > new file mode 100644 > index 000000000..ebd3d9e8f > --- /dev/null > +++ b/lib/librte_eal/windows/include/rte_windows_thread_types.h > @@ -0,0 +1,12 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2021 Microsoft Corporation > + */ > + > +#ifndef _RTE_THREAD_TYPES_H_ > +#define _RTE_THREAD_TYPES_H_ > + > +#include > + > +typedef DWORD rte_thread_t; > + > +#endif /* _RTE_THREAD_TYPES_H_ */ pthread_t type in pthreads-win32 and winpthread is not 32 bit. DPDK will have different ABI depending on a threading backend used. Apps must know it at build time then. How do they discover it? This is worth a warning in commit log and docs. > diff --git a/lib/librte_eal/windows/rte_thread.c b/lib/librte_eal/windows/rte_thread.c > index 667287c38..940d9c653 100644 > --- a/lib/librte_eal/windows/rte_thread.c > +++ b/lib/librte_eal/windows/rte_thread.c > @@ -1,5 +1,6 @@ > /* SPDX-License-Identifier: BSD-3-Clause > * Copyright 2021 Mellanox Technologies, Ltd > + * Copyright(c) 2021 Microsoft Corporation > */ > > #include > @@ -11,6 +12,18 @@ struct eal_tls_key { > DWORD thread_index; > }; > > +rte_thread_t > +rte_thread_self(void) > +{ > + return GetCurrentThreadId(); > +} > + > +int > +rte_thread_equal(rte_thread_t t1, rte_thread_t t2) > +{ > + return t1 == t2 ? 1 : 0; > +} > + "a == b" returns (int)0 or (int)1 in C.