From patchwork Thu Jun 1 10:08:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ga=C3=ABtan_Rivet?= X-Patchwork-Id: 24948 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 7D5517CCF; Thu, 1 Jun 2017 12:09:18 +0200 (CEST) Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com [74.125.82.42]) by dpdk.org (Postfix) with ESMTP id 279F36841 for ; Thu, 1 Jun 2017 12:09:12 +0200 (CEST) Received: by mail-wm0-f42.google.com with SMTP id d127so53521571wmf.0 for ; Thu, 01 Jun 2017 03:09:12 -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=BdcQ9ptLksoWUdd1foWVt0OqCTmtV8JCMoFHOF5ThLo=; b=x1lRHvVG3ut83/Z3sK4RBg8QAjX9/OXKe34Matnj1aT+Sr2kZ4hAEqRadzbnHDpgLw FHN86PLpwfjeFiZ/Oadzdx1YY0aURBL3Tr2L8dyE9DcK8fiiqxjljJrjiHhp61ykb/8N ksAOhY0Iu+KYafTo2MKG21UZmbpR1Qptz/Nh+kDWQlMJGsFOqBjMJxVlTWuHYvPZkWe/ 2u3m32zt6GGTgmYDl4A+nFy8CmZzZ2/UvnCaVdhL4J6oHt8uY2laweLtauaAtK/o3XLP +ncA2YPCLsZc0WDA1ixZv216B0keGpJIPj3AYOzWuRQzDIZRY1peIhL5g/47oHOZmvtX AbaA== 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=BdcQ9ptLksoWUdd1foWVt0OqCTmtV8JCMoFHOF5ThLo=; b=YH2Sri8NjCE95S3bHd/xlB078EqhuKpkS0x5HSyEwHNcaw4w+GU5Yb3270RtMUS3a4 88WYTxvXqZgB49Toj/uwujJ1CT4vfrvukLra2u+Y57zsO+hWJtBZPKrYpTDxcgJSY+KM n900vVzDrVYNoxKfQaF7xOEfQSjhXm/CUQ58VuhfGjMXwXFFbcgTNBCWN99UXOd0pS3f zP7XIueduPRpzUja3JJ8sHn3kIXWTVy0whfj35awdu6olLjEAr2OojTJf+OUwFk/pChx AxY097Iir0JD1U6jRcSllzSE8NJ3Ub/89C15EnbDywhLRLALuOfCrEpdN0FFNGQw7oDS jSmA== X-Gm-Message-State: AODbwcBmkiuYJYRY8/xNfcEdWPQYT8GmVY7AL6H1SROT3M1N4IM52x7W dyFxhg11WfOFinTzyrk= X-Received: by 10.28.14.17 with SMTP id 17mr1078332wmo.95.1496311752154; Thu, 01 Jun 2017 03:09:12 -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 r10sm24305457wmd.9.2017.06.01.03.09.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 01 Jun 2017 03:09:11 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Thu, 1 Jun 2017 12:08:53 +0200 Message-Id: <3b3a0ba64346e9b424b3c67620c6e7ce1ed94de0.1496311609.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 v3 3/9] 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 3bc4e1c..7e73d62 100644 --- a/lib/librte_eal/common/include/rte_bus.h +++ b/lib/librte_eal/common/include/rte_bus.h @@ -106,6 +106,26 @@ typedef int (*rte_bus_plug_t)(struct rte_devargs *da); typedef int (*rte_bus_unplug_t)(struct rte_devargs *da); /** + * 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 { @@ -116,6 +136,7 @@ struct rte_bus { rte_bus_find_device_t find_device; /**< Find device on 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 */ }; /**