From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f46.google.com (mail-wm0-f46.google.com [74.125.82.46]) by dpdk.org (Postfix) with ESMTP id A9C102B9C for ; Tue, 3 Jan 2017 22:52:50 +0100 (CET) Received: by mail-wm0-f46.google.com with SMTP id t79so440972293wmt.0 for ; Tue, 03 Jan 2017 13:52:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:user-agent:in-reply-to :references:mime-version:content-transfer-encoding; bh=iAwGg+MGfVR7G9QAoePsE7kkjZJSf+LLkcSm2KpCo/M=; b=J23jYWA6OKxNveTd2TQWBec5xTStbzZ9o2q+fkhJKh8HpAHF4DCS/+jwa5/ZNa3xLY dDgtwiKxpRMhrBioMSEnC64xHhHpIMn4Wc03Cvv0sZUUN0wMUHoLH3Js85vf2qAIYAoH KlyEi29edfty3wZ9QCRAyx66oK6QskelRHR525wK5dJCKt71z+qeIxwdnX2zqA5w3r0V UAigQriK3qejyp7ojs7cANmeW40lQ2DxQfc+0nlssuiy9c0TA8rmAOQ4fb+nXObNiS0K 0S6GPIPqrenLl5w594NRNOervGUBuE4HWLhJHKyyek4gY5l2oiHtuavZ8P+HQ0+jUKRD vAqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:user-agent :in-reply-to:references:mime-version:content-transfer-encoding; bh=iAwGg+MGfVR7G9QAoePsE7kkjZJSf+LLkcSm2KpCo/M=; b=MC3oGPw6P4OXFXvpBWT/D9FBVACrdhqsyZ17NJrbCbgjR2YMBUKJkB5aiK89pvT6Pg HqkOLM/QitAsbpGkjjrnnv2BjzbxkiKFxlkx6dayFtOo/lCWudoNHgWuzEn8lQm+AQLA mquOOVz+CgoPhh6jRgtfPmC+LGgrmaNr8CHyCfp/SeNYTDBf3OSBYHWWKpy+EOUwK/jU xoNoWX+rUCVVfjz1/88kruTDaUMI5/68beX3CCTEFawp8XVDzMj6VA4/Lo0jR3ixwECY ankN7w+0l6xl6yJhPpYAOsOZrti8JOr17Gyl+poHYmrimaAzI3LkbyCV15ccjEmGCaMn BW7A== X-Gm-Message-State: AIkVDXJd/hchSiciRozWDL/8STyvpZUGUA06xOrc4cl8dnlcG4qLUN842bjJl5nHiB2Yztl4 X-Received: by 10.28.149.79 with SMTP id x76mr51912283wmd.27.1483480370312; Tue, 03 Jan 2017 13:52:50 -0800 (PST) Received: from xps13.localnet (184.203.134.77.rev.sfr.net. [77.134.203.184]) by smtp.gmail.com with ESMTPSA id c187sm91550381wmd.13.2017.01.03.13.52.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Jan 2017 13:52:49 -0800 (PST) From: Thomas Monjalon To: Shreyansh Jain Cc: david.marchand@6wind.com, dev@dpdk.org Date: Tue, 03 Jan 2017 22:52:48 +0100 Message-ID: <12579803.ZHBMo4GdSA@xps13> User-Agent: KMail/4.14.10 (Linux/4.5.4-1-ARCH; KDE/4.14.11; x86_64; ; ) In-Reply-To: <1482758645-23057-2-git-send-email-shreyansh.jain@nxp.com> References: <1482756644-13726-1-git-send-email-shreyansh.jain@nxp.com> <1482758645-23057-1-git-send-email-shreyansh.jain@nxp.com> <1482758645-23057-2-git-send-email-shreyansh.jain@nxp.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v5 01/12] eal/bus: introduce bus abstraction 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: , X-List-Received-Date: Tue, 03 Jan 2017 21:52:50 -0000 2016-12-26 18:53, Shreyansh Jain: > +DPDK_17.02 { > + global: > + > + rte_bus_list; > + rte_eal_bus_add_device; > + rte_eal_bus_add_driver; > + rte_eal_bus_get; > + rte_eal_bus_dump; > + rte_eal_bus_register; > + rte_eal_bus_insert_device; > + rte_eal_bus_remove_device; > + rte_eal_bus_remove_driver; > + rte_eal_bus_unregister; I think the prefix can be just rte_bus_ instead of rte_eal_bus_. > +/** Double linked list of buses */ > +TAILQ_HEAD(rte_bus_list, rte_bus); > + > +/* Global Bus list */ > +extern struct rte_bus_list rte_bus_list; Why the bus list is public? > +/** > + * A structure describing a generic bus. > + */ > +struct rte_bus { > + TAILQ_ENTRY(rte_bus) next; /**< Next bus object in linked list */ > + struct rte_driver_list driver_list; > + /**< List of all drivers on bus */ > + struct rte_device_list device_list; > + /**< List of all devices on bus */ > + const char *name; /**< Name of the bus */ > +}; I am not convinced we should link a generic bus to drivers and devices. What do you think of having rte_pci_bus being a rte_bus and linking with rte_pci_device and rte_pci_driver lists? I'm thinking to something like that: struct rte_bus { TAILQ_ENTRY(rte_bus) next; const char *name; rte_bus_scan_t scan; rte_bus_match_t match; }; struct rte_pci_bus { struct rte_bus bus; struct rte_pci_driver_list pci_drivers; struct rte_pci_device_list pci_devices; }; > +/** Helper for Bus registration. The constructor has higher priority than > + * PMD constructors > + */ > +#define RTE_REGISTER_BUS(nm, bus) \ > +static void __attribute__((constructor(101), used)) businitfn_ ##nm(void) \ > +{\ > + (bus).name = RTE_STR(nm);\ > + rte_eal_bus_register(&bus); \ > +} By removing the lists from rte_bus as suggested above, do you still need a priority for this constructor? > struct rte_device { > TAILQ_ENTRY(rte_device) next; /**< Next device */ > + struct rte_bus *bus; /**< Device connected to this bus */ > const struct rte_driver *driver;/**< Associated driver */ > int numa_node; /**< NUMA node connection */ > struct rte_devargs *devargs; /**< Device user arguments */ > @@ -148,6 +149,7 @@ void rte_eal_device_remove(struct rte_device *dev); > */ > struct rte_driver { > TAILQ_ENTRY(rte_driver) next; /**< Next in list. */ > + struct rte_bus *bus; /**< Bus serviced by this driver */ > const char *name; /**< Driver name. */ > const char *alias; /**< Driver alias. */ > }; Do we need to know the bus associated to a driver in rte_driver? Bus and driver are already associated in rte_device.