From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com [74.125.82.51]) by dpdk.org (Postfix) with ESMTP id 99A942C29 for ; Thu, 8 Jun 2017 01:56:25 +0200 (CEST) Received: by mail-wm0-f51.google.com with SMTP id d73so20748866wma.0 for ; Wed, 07 Jun 2017 16:56:25 -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=BM2uWSmfdzXYnKHcBVo9LLJSjSRnLG1DYdE2xf/2wdU=; b=lMzwcPpy1TYhl5VgTp4e6wUcU4T99arwRoTeAxgpxxh0VGRdEfCeMbZukRW2WtNYCl vXPtRNjOiZdBhXT50oVcgEjduOZeA3dzdPSmMN2UzTBWODYwJVs0yyreZHIn81EwMgxf 9OmduHXdtsY8ItGKkH6DV68hwVSD4Jd1+KUL2SjXQwosNoAGHspBsY15zp8MiDGpkvcr U15JAPVwxYpURH35lV1xYIvSlvHYODksJm7bFpulxlfGDfx6JnGrjYOsq/0N8OMJPSmv 9okXjGPwb+WhcLKigpPQcL3ZipiL2AeN/dvoTFGxXM2YpLGthLKFZjP7z/6nQHoEjJD8 G9Hw== 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=BM2uWSmfdzXYnKHcBVo9LLJSjSRnLG1DYdE2xf/2wdU=; b=CwyPgMwo9ZApBNxgAfTSNhzTg0VHEo/C6D6qzhmMYoemxSRlhp3G5JbD+c0MtmyL+O 0DHfpE7pIewH5/jGCRKeT4OLwD/gGRqoHfoaFcx+og61YAmlCMFUPB2OXuczoK+OvSL2 +JByO1/7e039F+ka/ocKQwQ+d+WBNGoeayLxRJWLgJ6K7THZBs07R16Qfs4c5N52qiXs FKE+hKwK7TnI/nkT6AFTQM89dCTFa4K7rRIEQbfdAivVcnrRchQGERGAc//S0bbZk/6t yzr4/f3vfKzHjPijzZmfmZSoRCfKikdFKZeoee3kI5XvOJNADhsL/5Ovzdp3SZZ0AzEJ qT+A== X-Gm-Message-State: AODbwcA+9Y6ugpWgLAwO5cGtWK/EqNm8sJty2c+8f0PajHBdKxKP9Ijh b4Lp/EIZJ4OuEornAoM= X-Received: by 10.28.13.1 with SMTP id 1mr1459854wmn.12.1496879784968; Wed, 07 Jun 2017 16:56:24 -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 m40sm2624808wrm.4.2017.06.07.16.56.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Jun 2017 16:56:23 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Thu, 8 Jun 2017 01:56:03 +0200 Message-Id: <0f2054865be2835e0cd14882363c359d37e4b913.1496876810.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 v4 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: , X-List-Received-Date: Wed, 07 Jun 2017 23:56:26 -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 7264e3f..9b50451 100644 --- a/lib/librte_eal/common/include/rte_bus.h +++ b/lib/librte_eal/common/include/rte_bus.h @@ -117,6 +117,26 @@ typedef struct rte_device * (*rte_bus_plug_t)(struct rte_devargs *da); 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 { @@ -127,6 +147,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 */ }; /** -- 2.1.4