From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f47.google.com (mail-wm0-f47.google.com [74.125.82.47]) by dpdk.org (Postfix) with ESMTP id 446E12E81 for ; Wed, 25 May 2016 18:20:09 +0200 (CEST) Received: by mail-wm0-f47.google.com with SMTP id n129so190755306wmn.1 for ; Wed, 25 May 2016 09:20:09 -0700 (PDT) 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=pIwWWlNXSu4lHck6hg/AcZ9svkAx+tmDt6jheymkJQ4=; b=velmFvBelNuyellINcKR5Bdvvq+xRx7LRWkBsJbikxWFsEWLKCANUL/pqrXcwuaMHs xMBPYa9Ot+0xuH3nYpA7b+En6liOiM7Abgj3goZedqoXF4+JWew65zhn0g4tGSSpbrTD 0CE7FKa2vWII5zuLYIZ9ijoOVMNHEtQkFJ9I6dUByE/6qs30qsSThEy2ccdVuOMf4tU9 N8QoABEK8JK5Rh4MAKtOyKVYihWoUFWiegDG+ey38bww32eHaXgWTIhd4IPfy4vEq2U0 3oCmISV6Yka8MTgw5bDN0UkfCD8lh88sRiZejO+l+QGcbCe+xJhVjsAPL20YL5H+67UT 6i8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:user-agent :in-reply-to:references:mime-version:content-transfer-encoding; bh=pIwWWlNXSu4lHck6hg/AcZ9svkAx+tmDt6jheymkJQ4=; b=AKh1R8Rds5qqFUKX+Vb1SPAhrj5zGFPfm8CqFKvW2EzIDy0hRXprunc76/M7ctzz5c EH1KDAZVLz7obnJO8mUZXSDXq2H3yePIr4eULTIA4NTnlNjtZ2qjLu+bXtCeS99T/8Su guijndW0HwQW7fnJXKLquNIDUUiywBtksKlIid1je1NXlqiTAWXO3A9cm22/kTyBJzph hgBppn5tpDArsyVRzP+QjzVoWR9osTBv+hxs9g97wmhmAgymwwnJqJUKMlBLoTeF+Qcf o2BO317wm77+h3evzfoEANlT2NSw51q6mkcLA9OlXhwO8RBG4G2RMIm+3UEA2A84Zv+l FICA== X-Gm-Message-State: ALyK8tINnR0nNZMIz8Km9H69szsmVqCNc/NPphCOiHXBfwe2+ZZLGGf/EUS1wzrjyVVAmJ07 X-Received: by 10.194.143.51 with SMTP id sb19mr5524279wjb.175.1464193208845; Wed, 25 May 2016 09:20:08 -0700 (PDT) Received: from xps13.localnet (184.203.134.77.rev.sfr.net. [77.134.203.184]) by smtp.gmail.com with ESMTPSA id j6sm9621088wjb.29.2016.05.25.09.20.07 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 25 May 2016 09:20:07 -0700 (PDT) From: Thomas Monjalon To: Neil Horman Cc: dev@dpdk.org, Bruce Richardson , Stephen Hemminger , Panu Matilainen Date: Wed, 25 May 2016 18:20:06 +0200 Message-ID: <19273886.LC4JPNcjGO@xps13> User-Agent: KMail/4.14.10 (Linux/4.1.6-1-ARCH; KDE/4.14.11; x86_64; ; ) In-Reply-To: <1464118912-19658-3-git-send-email-nhorman@tuxdriver.com> References: <1463431287-4551-1-git-send-email-nhorman@tuxdriver.com> <1464118912-19658-1-git-send-email-nhorman@tuxdriver.com> <1464118912-19658-3-git-send-email-nhorman@tuxdriver.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCHv4 2/5] drivers: Update driver registration macro usage X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 May 2016 16:20:09 -0000 2016-05-24 15:41, Neil Horman: > Modify the PMD_REGISTER_DRIVER macro, adding a name argument to it. The > addition of a name argument creates a token that can be used for subsequent > macros in the creation of unique symbol names to export additional bits of > information for use by the pmdinfogen tool. For example: > > PMD_REGISTER_DRIVER(ena_driver, ena); > > registers the ena_driver struct as it always did, and creates a symbol > const char this_pmd_name0[] __attribute__((used)) = "ena"; > > which pmdinfogen can search for and extract. The EAL rework (http://dpdk.org/ml/archives/dev/2016-April/037691.html) integrates already a name: +#define RTE_EAL_PCI_REGISTER(name, d) \ +RTE_INIT(pciinitfn_ ##name); \ +static void pciinitfn_ ##name(void) \ +{ \ + rte_eal_pci_register(&d); \ +} I think it would be better to rebase on top of it. > The subsequent macro > > DRIVER_REGISTER_PCI_TABLE(ena, ena_pci_id_map); > > creates a symbol > const char ena_pci_tbl_export[] __attribute__((used)) = "ena_pci_id_map"; > > Which allows pmdinfogen to find the pci table of this driver > > Using this pattern, we can export arbitrary bits of information. > > pmdinfo uses this information to extract hardware support from an object file > and create a json string to make hardware support info discoverable later. > --- a/drivers/Makefile > +++ b/drivers/Makefile > @@ -34,4 +34,6 @@ include $(RTE_SDK)/mk/rte.vars.mk > DIRS-y += net > DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += crypto > > +DEPDIRS-y += buildtools/pmdinfo Why pmdinfo is a build dependency? > --- a/lib/librte_eal/common/include/rte_dev.h > +++ b/lib/librte_eal/common/include/rte_dev.h > @@ -48,7 +48,7 @@ extern "C" { > > #include > #include > - > +#include Why not keep PCI stuff in rte_pci.h? > +#define DRV_EXP_TAG(n, t) __##n##_##t > + > +#define DRIVER_REGISTER_PCI_TABLE(n, t) \ > +static const char DRV_EXP_TAG(n, pci_tbl_export)[] __attribute__((used)) = RTE_STR(t) I really dislike one-char variables, especially when there is no comment. Please choose comments or explicit variables.