From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 66DD8A04FA; Wed, 5 Feb 2020 20:54:55 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4A57E1D155; Wed, 5 Feb 2020 20:54:55 +0100 (CET) Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by dpdk.org (Postfix) with ESMTP id 38A3C1D157 for ; Wed, 5 Feb 2020 20:54:54 +0100 (CET) Received: by mail-lj1-f195.google.com with SMTP id x14so3539291ljd.13 for ; Wed, 05 Feb 2020 11:54:54 -0800 (PST) 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=goAaj+4nTQ4rr4Kwy6IYakPrKZE5nlEnoPYgU9kEVOk=; b=gwhSUheqrFubFym+GO48OgywrIrq6JtJpJtMUJVCQse+dD8AKWP7QtyHMJZBK2xihc +C6EaAyEiGh/FJq4QNYWuhTqrop1W/rOquhFKzxkCuLUii9WZXgK6Qzm8ugskscHCowr beWF8LpXa6dBpHJBf36TJ7m6kaSQv8RnLTFbzNM7TvAtw4BCj+ScwDU7lx2zYu22DHvt VJtzqQxtnEEbQC4qb7kZ31mAUmoag/QnW7efO+B1bJmRRC/aqgsHWULKFInrHApnHct5 fnGiNCrNbJF5P+Hq3/BY3iIi5rHfynaeU6w5IhajOOdm3hJUnifIEavvaNozrlbHM7xG l8eg== 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=goAaj+4nTQ4rr4Kwy6IYakPrKZE5nlEnoPYgU9kEVOk=; b=rMNT+jyT7o9L75H5FYDxmTUIiTUO39MfFIUgPjgdgyAWpzv/dBVbF2YaHbNR4ELSQU dEpUFQB7odPPgarLipTr/gKGWiGinkStejeWLtAwgUCOVHDVW7GEv1BgU0GnVQVaEt4R 1xfIcPuZdwY/NUhG0qo/2vMmZ24N0FFFfZ+31XF0cC66/kAGhumKzp9IOPxmDOdJqyup /MUbdwqS5isgNiSm6L2hF1ZC5sPiWh9EQYTOzWXq04aZCWAe6g6NzEakqeLJBYFnM1Tx mvDgBzJn9hzVrUQaZ+BiqVO7fOYo0HPwOpPVJhaSoEYzrtu1mWhQ72TCY07d8YZD2J33 ULvw== X-Gm-Message-State: APjAAAXWIBtNQx+RXWlOFch4LoV61V0CeCJgbOsxFyZBnE3rXaE3jQWe t3/YLMg/phS+0G0DZP/lwwE= X-Google-Smtp-Source: APXvYqy2osNjOmwUpSHLvHVzeCbGYLJ3GtD15/iberGQyZMKkrJ4PA5kmxIEm2+06Oc9pRUtIBjgEQ== X-Received: by 2002:a2e:a0d0:: with SMTP id f16mr21177626ljm.130.1580932493798; Wed, 05 Feb 2020 11:54:53 -0800 (PST) Received: from Sovereign (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id z8sm227189ljc.44.2020.02.05.11.54.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 11:54:53 -0800 (PST) Date: Wed, 5 Feb 2020 22:54:52 +0300 From: Dmitry Kozlyuk To: Pallavi Kadam Cc: dev@dpdk.org, thomas@monjalon.net, Harini.Ramakrishnan@microsoft.com, keith.wiles@intel.com, bruce.richardson@intel.com, david.marchand@redhat.com, jerinjacobk@gmail.com, ranjit.menon@intel.com, antara.ganesh.kolar@intel.com Message-ID: <20200205225452.5fbc970b@Sovereign> In-Reply-To: <20200201000406.11060-4-pallavi.kadam@intel.com> References: <20200131000307.10608-1-pallavi.kadam@intel.com> <20200201000406.11060-1-pallavi.kadam@intel.com> <20200201000406.11060-4-pallavi.kadam@intel.com> X-Mailer: Claws Mail 3.17.4 (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 v7 3/9] eal: add additional function overrides in windows header files X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" > +#include Nit: better use lowercase to support cross-compilation from OS with case-sensitive FS. It's not directly relevant for this patch. > +static inline int > +eal_get_thread_affinity_mask(pthread_t threadID, unsigned long *cpuset) > +{ > + /* Workaround for the lack of a GetThreadAffinityMask() > + *API in Windows > + */ > + /* obtain previous mask by setting dummy mask */ > + DWORD dwPrevAffinityMask = > + SetThreadAffinityMask((HANDLE) threadID, 0x1); > + /* set it back! */ > + SetThreadAffinityMask((HANDLE) threadID, dwPrevAffinityMask); > + *cpuset = dwPrevAffinityMask; > + return 0; > +} Shouldn't EAL implementation follow DPDK code style? If so, "threadID" and "dwPrevAffinityMask" violate naming convention, also there's a bogus TAB. > +static inline int > +eal_create_thread(void *threadID, void *threadfunc, void *args) > +{ > + HANDLE hThread; > + hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)threadfunc, > + args, 0, (LPDWORD)threadID); > + if (hThread) { > + SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS); > + SetThreadPriority(hThread, THREAD_PRIORITY_TIME_CRITICAL); > + } > + return ((hThread != NULL) ? 0 : E_FAIL); > +} Duplicates eal_thread_create() from "eal_thread.c", probably eal_thread_create() should call pthread_create() as in Linux EAL. > +static inline int > +pthread_join(pthread_t thread __attribute__((__unused__)), > + void **value_ptr __attribute__((__unused__))) > +{ > + return 0; > +} If not implemented, should return EINVAL (ENOSUP is not listed as a valid error code for this function). Even better, implement trivially with WaitForSingleObject(). > +static inline int > +asprintf(char **buffer, const char *format, ...) > +{ > + int size, ret; > + va_list arg; > + > + va_start(arg, format); > + size = vsnprintf(NULL, 0, format, arg) + 1; > + va_end(arg); > + > + *buffer = malloc(size); Missing a check for NULL from malloc(). > + > + va_start(arg, format); > + ret = vsnprintf(*buffer, size, format, arg); > + va_end(arg); > + if (ret != size - 1) { > + free(*buffer); > + return -1; > + } > + return ret; > +} > +static inline int > +count_cpu(rte_cpuset_t *s) > +{ > + unsigned int _i; Why the underscore? It's not a macro, identifiers are function-local. > +/* > + * List definitions. > + */ > +#define LIST_HEAD(name, type) \ > +struct name { \ > + struct type *lh_first; /* first element */ \ > +} > + > #define QMD_TRACE_ELEM(elem) > #define QMD_TRACE_HEAD(head) > #define TRACEBUF Probably ouf of scope for this patchset, but DPDK should probably include the entire FreeBSD so that we won't need to add it piece-by-piece like so. It's BSD-3-Clause anyway. -- Dmitry Kozlyuk