From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f179.google.com (mail-wr0-f179.google.com [209.85.128.179]) by dpdk.org (Postfix) with ESMTP id 727B83254 for ; Fri, 7 Jul 2017 02:03:43 +0200 (CEST) Received: by mail-wr0-f179.google.com with SMTP id r103so24284204wrb.0 for ; Thu, 06 Jul 2017 17:03:43 -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=z5jdzc+YoRJycq2pNmM3/+JbdKd5LE9OPQ4TQUqUGDo=; b=sU6LAZbLlYi1McN/PcFVhQ9iWL6gfrwpVwKpnzKUz+L7/UCHJ2iTQ/GqgnKYsBWlue zNCOlg9K58hqqKGeSmTyKQqX4R2FI01xjx0gh/YBuACSAGnNAo7nzBFd4QgbTNEC3sS6 eeIOsY7lLgl3xEjvq6sqUbgng7RsoOTnms8uzLYf2cFzq3Za8raYRp0D3dtHcAawaSY3 t0HXXVrJZYU2gBPTdcmxh5N6YciXQludwdiv/pMm53aExevptlP6sVMEEGDgMb25Y5Go E3ggTL4snKUNPF1uYATBVbu7KmCEZhOpqhygzdvCAkhfwPuyfFHOjDF37d9HPFCoa0eD WoZw== 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=z5jdzc+YoRJycq2pNmM3/+JbdKd5LE9OPQ4TQUqUGDo=; b=Wo2qIJeZH7yKbUh28t2opHuUfw3Uu/0X08lDnWOwxpVPQcDNHCFhRy4WUJ5NnYS80E S6cxpKeVJKe7FHkrScl3e17bkG2vGWUSt+L5mPb3gBaKzQF7G8bglhNp21dxLW6MdnKq evdXuxX7Nx80t3XwSyZ+c2mwblbs5eWqZlz8OPxorhUF+lhZrBwXXOzmxy+OVqA/NRxN aekNWvijlUTwRuDcaqzWmFjQkOUKH7CMVf45Uy+fXH8GV5WKmBp4M5lH2x7biyngPByP +0Gb7Wv/82qoSg8c0Ug2AMCyH5C7dzkHBr7RUM6k1If3ixzHMn4lH03z5mCI0fUjaxBM zMPA== X-Gm-Message-State: AKS2vOwc5ezVgJulXWU2giOt/p2Dz2NFVuroOwItYs5PTz9KUB5rZBO0 9nMjieJZ/lnOZp/sXMw= X-Received: by 10.223.154.141 with SMTP id a13mr42004134wrc.139.1499385822779; Thu, 06 Jul 2017 17:03:42 -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 p7sm2364921wmf.11.2017.07.06.17.03.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 06 Jul 2017 17:03:41 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Fri, 7 Jul 2017 02:03:08 +0200 Message-Id: <30135c8df2b6ad1c0972978defcc210d42e99f73.1499384335.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v8 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: Fri, 07 Jul 2017 00:03:44 -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. Implementing this function allows EAL initialization routines to infer which bus should handle a device. This is used as a way to respect backward compatibility. This API will disappear once this compatibility is not enforced anymore. Signed-off-by: Gaetan Rivet Acked-by: Bruce Richardson Acked-by: Shreyansh Jain --- 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