From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 2EA7DA0526;
	Fri, 24 Jul 2020 15:41:27 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id E72101C025;
	Fri, 24 Jul 2020 15:41:25 +0200 (CEST)
Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com
 [207.211.31.81]) by dpdk.org (Postfix) with ESMTP id 9D39A1C01E
 for <dev@dpdk.org>; Fri, 24 Jul 2020 15:41:24 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1595598084;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=B6nrXB7X5xnh+H808MBM/ckJdijHbePISfUDWg48PhY=;
 b=XmJFE70KHinecrQa5i5xq1fzoc+gU9KV4bc8LhCe7MM20noLBKrthq5Aimz2vMAnjqbiOU
 +FE/vw3CP+5PEnTU+0/hblb0LwGgYp/3XH8hZTIGKDFn+menknBTCbQFsnIBpsg2sh2SqH
 UQ84E6twlNl5SRCapfIjqUvnBPNbKZU=
Received: from mail-vk1-f200.google.com (mail-vk1-f200.google.com
 [209.85.221.200]) (Using TLS) by relay.mimecast.com with ESMTP id
 us-mta-339-f0Xu9pK_MPKRwr81sLNy7w-1; Fri, 24 Jul 2020 09:41:20 -0400
X-MC-Unique: f0Xu9pK_MPKRwr81sLNy7w-1
Received: by mail-vk1-f200.google.com with SMTP id u203so2922796vkb.9
 for <dev@dpdk.org>; Fri, 24 Jul 2020 06:41:20 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=B6nrXB7X5xnh+H808MBM/ckJdijHbePISfUDWg48PhY=;
 b=JrIc5kS/ngEJFKurMfnR8YmEQNu1EMu8SY7c15+nenJHKhLEvSz5xjR1W/Os+aWyx2
 l1pXWAS8zeUU7q3XJFN49rJY7TRR1MUTliu+9Uz4vwbE2NhR/IpCX+wC2c4ChvljVa1Y
 4/Y6BdyvXjJ8Shm/6rIf46t7dmUJbwGcNnGHjyCNC3U1otBbZXy7rIRzo5VrDVBR/70M
 jV8qkiWoH1qBciWovovbcU9Q8EH0Z2evmmaWPbnLMvPwFRPz3gHwQXn47HUhqp6/grFO
 ebE5DqesOJ9yUA5N3TF9z8DEpS7cFW0SD1CRXNV01hrdv8SWBxm4xXxrRFD69yN9wHlw
 dIbQ==
X-Gm-Message-State: AOAM5326DT53xzZTgrlZfR3qEdw/ZWTA29fBi7nYnaGFe/bR9kfyJXeN
 b9QC619jXyF6/VxGegOfrgjkBvQpux/mQg5Qur0CH/V28uMNpQTimgm16y6GoILUTH7DkE5mqjV
 vVGCZY60jD534qiPG/h8=
X-Received: by 2002:a9f:31f3:: with SMTP id w48mr7964834uad.87.1595598079682; 
 Fri, 24 Jul 2020 06:41:19 -0700 (PDT)
X-Google-Smtp-Source: ABdhPJxuWiF6JzWkgon8vbTGsjtPazAPokp9hBbXrcf0YQOe9tDXmF/aXG5TJ3s2LsJ1oZSV4iRcmHZDEyhoAnSI52o=
X-Received: by 2002:a9f:31f3:: with SMTP id w48mr7964811uad.87.1595598079423; 
 Fri, 24 Jul 2020 06:41:19 -0700 (PDT)
MIME-Version: 1.0
References: <20200610171728.89-2-parav@mellanox.com>
 <20200723200910.376581-1-parav@mellanox.com>
 <20200723200910.376581-4-parav@mellanox.com>
In-Reply-To: <20200723200910.376581-4-parav@mellanox.com>
From: David Marchand <david.marchand@redhat.com>
Date: Fri, 24 Jul 2020 15:41:08 +0200
Message-ID: <CAJFAV8xSBpEB_6pvmQiq5kyCkYqF==bwZH8B-V=odK3Y6x7pVw@mail.gmail.com>
To: Parav Pandit <parav@mellanox.com>
Cc: dev <dev@dpdk.org>, Gaetan Rivet <grive@u256.net>, 
 "Yigit, Ferruh" <ferruh.yigit@intel.com>, Thomas Monjalon <thomas@monjalon.net>,
 Raslan <rasland@mellanox.com>, Ori Kam <orika@mellanox.com>, 
 Matan Azrad <matan@mellanox.com>, Joyce Kong <joyce.kong@arm.com>
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Type: text/plain; charset="UTF-8"
Subject: Re: [dpdk-dev] [PATCH v8 03/10] drivers: relax dependency order
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

On Thu, Jul 23, 2020 at 10:10 PM Parav Pandit <parav@mellanox.com> wrote:
>
> From: Thomas Monjalon <thomas@monjalon.net>
>
> Drivers dependencies are evaluated in the order defined per
> their parent directory (also called class).
> This strict ordering prevent from having 2 different drivers
> of the same class with different dependencies ordering.
> This problem occurs if drivers/common/mlx5 depends on drivers/bus/pci,
> while drivers/bus/dpaa depends on drivers/common/dpaax.
> Having a strict ordering between directories bus and common
> is too much restrictive.
>
> That's why it is made possible to have a more fine-grain directory list,
> adding a driver sub-directory in the list.
> In this case, the isolated driver must be removed from its class list,
> and added directly in drivers/meson.build.
> Also, the per-class variables must be duplicated in the isolated driver,
> because the call "subdir(class)" is skipped in the isolated driver case.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
>  drivers/meson.build | 28 +++++++++++++++++++++-------
>  1 file changed, 21 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/meson.build b/drivers/meson.build
> index e2aeba931..e6d0409aa 100644
> --- a/drivers/meson.build
> +++ b/drivers/meson.build
> @@ -1,8 +1,8 @@
>  # SPDX-License-Identifier: BSD-3-Clause
>  # Copyright(c) 2017-2019 Intel Corporation
>
> -# Defines the order in which the drivers are buit.
> -dpdk_driver_classes = [
> +# Defines the order of dependencies evaluation
> +subdirs = [
>         'common',
>         'bus',
>         'mempool', # depends on common and bus.
> @@ -27,7 +27,7 @@ if cc.has_argument('-Wno-format-truncation')
>         default_cflags += '-Wno-format-truncation'
>  endif
>
> -foreach class:dpdk_driver_classes
> +foreach subpath:subdirs
>         drivers = []
>         std_deps = []
>         config_flag_fmt = '' # format string used to set the value in dpdk_conf
> @@ -35,8 +35,22 @@ foreach class:dpdk_driver_classes
>                              # the library, the dependency and to find the
>                              # version file for linking
>
> -       subdir(class)
> -       class_drivers = []
> +       # subpath can be either "class" or "class/driver"
> +       if subpath.contains('/')
> +               driver_path = subpath.split('/')
> +               class = driver_path[0]
> +               drivers += driver_path[1]
> +       else
> +               class = subpath
> +               subdir(class)
> +       endif
> +
> +       # save class name on first occurence
> +       if not dpdk_driver_classes.contains(class)
> +               dpdk_driver_classes += class
> +       endif
> +       # get already enabled drivers of the same class
> +       enabled_drivers = get_variable(class + '_drivers', [])
>
>         foreach drv:drivers
>                 drv_path = join_paths(class, drv)
> @@ -96,7 +110,7 @@ foreach class:dpdk_driver_classes
>                                                 '_disable_reason', reason)
>                         endif
>                 else
> -                       class_drivers += name
> +                       enabled_drivers += name
>
>                         if fmt_name == ''
>                                 fmt_name = name
> @@ -203,5 +217,5 @@ foreach class:dpdk_driver_classes
>                 endif # build
>         endforeach
>
> -       set_variable(class + '_drivers', class_drivers)
> +       set_variable(class + '_drivers', enabled_drivers)
>  endforeach
> --
> 2.25.4
>

Reviewed-by: David Marchand <david.marchand@redhat.com>


-- 
David Marchand