From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f176.google.com (mail-wr0-f176.google.com [209.85.128.176]) by dpdk.org (Postfix) with ESMTP id A648E377E for ; Wed, 5 Jul 2017 01:55:40 +0200 (CEST) Received: by mail-wr0-f176.google.com with SMTP id c11so255172056wrc.3 for ; Tue, 04 Jul 2017 16:55:40 -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:in-reply-to:references :in-reply-to:references; bh=6KjuUc7gFEUrzsBcTUm8JO8JK6d95i+BYQSRWd/AtUk=; b=REaXlWIOwLxjPRQsWtvKf/bDbisGqfjiRw8U7vmoz+lH8C5usA3QUi7XM6TlOsjGM4 9acDM1lYB7Bj12xbgXMUO2kj7Ocx8fFpeQGy7mkjmERkSkCROIeQYx36fGAx/Y6WbPDR 4hltQpiVsTR2YkC6v/scJRvAtbYU5qVfyzURPCVppGlrSKP8pCvixDsjaRql+HRCPeLv T0quzEcO/cCYwrLnN8MZ0LpJSu1ORsvZQwiRkDL/EPu1sA7lowISl5x390/tsCgtWVGT VKCXoXROx2Ai2rN7k7VNC1T4Ci2CmY8GZQDM0qTHVarxo/Y/dZzlRIQd4l+LUJGRsFX4 IsVw== 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:in-reply-to :references:in-reply-to:references; bh=6KjuUc7gFEUrzsBcTUm8JO8JK6d95i+BYQSRWd/AtUk=; b=MWyXrjkiL6hUAUb/k8iiY+C1eGIi0NdgY2PjqKnOYjW5KnVJ1k6mMn+SyeLAP7CoGl RTgaSDNyb4T3hg5fKGLec//Iq3p2vj8pWL2XF8F06He7aZ8l/VLsitxDrB+hthx6CE3A xeNAYe2MK0FhRR+y54MTIHoDUwFSfhxzACKgaV73Pker4HChYuGBLQy0Vq5qQa3dks3f VQoxpafF5jF30Ct7TbreifR/AfgUbiDrXF8agrp+eFaePxAJ9h6TGqmWeUwMecvLJKfr YbzVB8zilEVFAjjfqG9UPbQ/l4JMpZtkFOvJmI7JEleqUbUrg2E3PiEBoyOipq45gejK AUiA== X-Gm-Message-State: AKS2vOykkqpVMheljnQZyrSsG4cCdyKhwuAQGD4gO9HNGUeWa4Zf+Mfg 2iskg17AqH9Dyixh9hM= X-Received: by 10.223.128.209 with SMTP id 75mr29828682wrl.99.1499212540008; Tue, 04 Jul 2017 16:55:40 -0700 (PDT) Received: from bidouze.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id 19sm23406533wrx.26.2017.07.04.16.55.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 04 Jul 2017 16:55:39 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Wed, 5 Jul 2017 01:55:19 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v7 2/6] bus: introduce parsing functionality 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, 04 Jul 2017 23:55:41 -0000 This operation can be used either to validate that a device representation can be understood by a bus, as well as store the resulting specialized device representation in any format determined by the bus. Signed-off-by: Gaetan Rivet --- lib/librte_eal/common/include/rte_bus.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h index 773b0d7..aebf57e 100644 --- a/lib/librte_eal/common/include/rte_bus.h +++ b/lib/librte_eal/common/include/rte_bus.h @@ -138,6 +138,26 @@ typedef int (*rte_bus_plug_t)(struct rte_device *dev, typedef int (*rte_bus_unplug_t)(struct rte_device *dev); /** + * Bus specific parsing function. + * Validates the syntax used in the textual representation of a device, + * If the syntax is valid and ``addr`` is not NULL, writes the bus-specific + * device representation to ``addr``. + * + * @param[in] name + * device textual description + * + * @param[out] addr + * device information location address, into which parsed info + * should be written. If NULL, nothing should be written, which + * is not an error. + * + * @return + * 0 if parsing was successful. + * !0 for any error. + */ +typedef int (*rte_bus_parse_t)(const char *name, void *addr); + +/** * A structure describing a generic bus. */ struct rte_bus { @@ -148,6 +168,7 @@ struct rte_bus { rte_bus_find_device_t find_device; /**< Find a device on the bus */ rte_bus_plug_t plug; /**< Probe single device for drivers */ rte_bus_unplug_t unplug; /**< Remove single device from driver */ + rte_bus_parse_t parse; /**< Parse a device name */ }; /** -- 2.1.4