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 BA40EA0350; Tue, 30 Jun 2020 12:15:12 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5BD331B9BF; Tue, 30 Jun 2020 12:15:12 +0200 (CEST) Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by dpdk.org (Postfix) with ESMTP id B73EE2B9C for ; Tue, 30 Jun 2020 12:15:10 +0200 (CEST) Received: by mail-wm1-f68.google.com with SMTP id q15so18245670wmj.2 for ; Tue, 30 Jun 2020 03:15:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=i1oHoBNIBKVArxAWK+j8Fe2PD8lupVZQVzGRCwWi+GU=; b=gkW3s6GrJor5uWUtMqpnrIPYNea8g5MdpCm9edEDQUIBl0aQ5cY4it/HpELD9JzpKX AwdLUMw618dAU6lj9eiXYOvbLZjQ9YapBcz6KuEh8wVXQnRJEskFh2LCHm2v0iM9xUwc melzSBvGyH+1MgeKrkTgYD10DIOBeKRmzWw7SzmX2hxItUL/Vpyx5H8UddyJTkBfFfDJ 5rUC3DF/ze1vWfawZQAv39UmjkpJjtmV15pXdW86Sy6oTZREjUrslTfH3vuLFYzyEYvr gZNQkaTwXJ6/25d86KluC5MVVgaAWb1na0S17+Xdxy0/OGYFVN2JoAm8JgDtL5VTAq6B IBNw== 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:references :mime-version:content-disposition:in-reply-to:user-agent; bh=i1oHoBNIBKVArxAWK+j8Fe2PD8lupVZQVzGRCwWi+GU=; b=i//wz+tBIi0FUVN/1OdN80tSYOXSy2uoJRJGFCSwndrmo3cKJzi96v8yXEu5wayEd6 +fJJk9qJH7u1tCl2e7YCK8H8ABzHfK/03qMKNQ7aIZNpETKtpOksbtFlsEYguxVpDuwA dhGPyi33vK1R1D+ThrMRm5iW4UtBxWMpqjtyMLGDD/6IL2eoXNKafd2jL4HelTGq7dtY JILkvOkJlwsFixj+Bw7j2xGeBxWdOjvClHA32SBr1VgsQgy/cOQ5BabzM28luI8rfsXl /e2ITq5k/sCfzFDAWmMM+AuWDx/dYdRCUna1WIUxYiUHmdQem3zrdKsNjc+Q/zWWjM5O dZOw== X-Gm-Message-State: AOAM531DQi7L7bAZ26MOfsYNvhs/NGv2Aiu69iZgfzwtfw37+5s5jaMM F13keo4j9u9cj+iOjUkghdDPmg== X-Google-Smtp-Source: ABdhPJy164ApsjjFdZzd4SOFrS1HgLyoSWGAPxo0yD/o+4Sm0FhM9L+y9YoDYf1NTCqw4cQoGFeOhA== X-Received: by 2002:a7b:c043:: with SMTP id u3mr22132033wmc.185.1593512110440; Tue, 30 Jun 2020 03:15:10 -0700 (PDT) Received: from 6wind.com (2a01cb0c0005a600345636f7e65ed1a0.ipv6.abo.wanadoo.fr. [2a01:cb0c:5:a600:3456:36f7:e65e:d1a0]) by smtp.gmail.com with ESMTPSA id z6sm2898507wmf.33.2020.06.30.03.15.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2020 03:15:09 -0700 (PDT) Date: Tue, 30 Jun 2020 12:15:09 +0200 From: Olivier Matz To: David Marchand Cc: dev@dpdk.org, jerinjacobk@gmail.com, bruce.richardson@intel.com, mdr@ashroe.eu, thomas@monjalon.net, arybchenko@solarflare.com, ktraynor@redhat.com, ian.stokes@intel.com, i.maximets@ovn.org, Neil Horman Message-ID: <20200630101509.GI5869@platinum> References: <20200610144506.30505-1-david.marchand@redhat.com> <20200626144736.11011-1-david.marchand@redhat.com> <20200626144736.11011-8-david.marchand@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200626144736.11011-8-david.marchand@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Subject: Re: [dpdk-dev] [PATCH v4 7/9] eal: add lcore init callbacks 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" On Fri, Jun 26, 2020 at 04:47:34PM +0200, David Marchand wrote: > DPDK components and applications can have their say when a new lcore is > initialized. For this, they can register a callback for initializing and > releasing their private data. > > Signed-off-by: David Marchand 2 more minor comments. > diff --git a/app/test/test_lcores.c b/app/test/test_lcores.c > index 864bcbade7..e36dceedf9 100644 > --- a/app/test/test_lcores.c > +++ b/app/test/test_lcores.c > @@ -5,6 +5,7 @@ > #include > #include > > +#include > #include > > #include "test.h" > @@ -113,6 +114,229 @@ test_non_eal_lcores(unsigned int eal_threads_count) > return ret; > } > > +struct limit_lcore_context { > + unsigned int init; > + unsigned int max; > + unsigned int uninit; > +}; > +static int > +limit_lcores_init(unsigned int lcore_id __rte_unused, void *arg) > +{ > + struct limit_lcore_context *l = arg; > + > + l->init++; > + if (l->init > l->max) > + return -1; > + return 0; > +} > +static void > +limit_lcores_uninit(unsigned int lcore_id __rte_unused, void *arg) > +{ > + struct limit_lcore_context *l = arg; > + > + l->uninit++; > +} missing empty lines [...] > +static int > +test_non_eal_lcores_callback(unsigned int eal_threads_count) > +{ > + struct thread_context thread_contexts[2]; > + unsigned int non_eal_threads_count; > + struct limit_lcore_context l[2]; > + unsigned int registered_count; > + struct thread_context *t; > + void *handle[2]; > + unsigned int i; > + int ret; > + > + memset(l, 0, sizeof(l)); > + handle[0] = handle[1] = NULL; > + non_eal_threads_count = 0; > + registered_count = 0; > + what about initializing it at declaration? struct thread_context thread_contexts[2] = {}; struct limit_lcore_context l[2] = {}; void *handle[2] = {};