From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by dpdk.org (Postfix) with ESMTP id E3CE81B42A for ; Wed, 11 Jul 2018 10:19:10 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id EACF4337; Wed, 11 Jul 2018 04:19:09 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Wed, 11 Jul 2018 04:19:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=mesmtp; bh=R5/iw1qZc18+Dx9Xey/5+ybyE8 tuEB5LILpDMPX+Xkw=; b=Iu8WvGjHORXmVRGpVcnPOuGDV2A/yqmB8c6HlO/PDY 9z2PmiU8zvbEpTOLyFYozlFTiTewXvwXbZB6KCIQMi/iDTKQN15v22oXiFcJTsRY T/l5/fsJX4ihIGRNDfpN5OFc3p+ZIRtddQvcWJ/koeUtIGXkeZSs9RjP10G6RJD4 M= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=R5/iw1 qZc18+Dx9Xey/5+ybyE8tuEB5LILpDMPX+Xkw=; b=bVakyqSnFDUmcsrORC2puC T5QGvXiO4wZinAJiKsNXsFIES22f3Gm4950OL4+OHA+fCnwTyB/D2Wr4SpbmNycr zPEJBSQ5s5x3Bk8qM7zDvXAuhMURq59gAYrKErqdE0XG9uWVoJtb0pr1OCr5Jke4 f3iJ1yYieWD+qjpuVXanaugQDgnkh/nqivLA8cA2y4eFUglbElU+Bmp4s9mliqPH 6LfWQSP0RUbDbGYJMS5VSjk/uLWgkCnnSB5EoxaTwJpjVE70mFCdvG2PAMlCdr67 AojI9qGoaS1Z4fyROvFZS73zA3Og8z5ZtGsEO91v4IQ/c7ED8YVcmbz+/lMibPlA == X-ME-Proxy: X-ME-Sender: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id CEDE81026C; Wed, 11 Jul 2018 04:19:08 -0400 (EDT) From: Thomas Monjalon To: Gaetan Rivet Cc: dev@dpdk.org Date: Wed, 11 Jul 2018 10:19:07 +0200 Message-ID: <2914659.2M3dPKUJVY@xps> In-Reply-To: <0a2d77e22658987a6e1e650913f020a140c2c1a9.1530791217.git.gaetan.rivet@6wind.com> References: <0a2d77e22658987a6e1e650913f020a140c2c1a9.1530791217.git.gaetan.rivet@6wind.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v10 08/27] devargs: add function to parse device layers 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, 11 Jul 2018 08:19:11 -0000 05/07/2018 13:48, Gaetan Rivet: > +/** > + * @internal > + * Parse a device string and store its information in an > + * rte_devargs structure. Please, explain what is a layer. > + * > + * Note: if the "data" field of da points to devstr, Better to use "devargs" as variable name, instead of "da". > + * then no dynamic allocation is performed and the rte_devargs > + * can be safely discarded. > + * > + * Otherwise ``data`` will hold a workable copy of devstr, that will be > + * used by layers descriptors within rte_devargs. In this case, > + * any rte_devargs should be cleaned-up before being freed. > + * > + * @param da > + * rte_devargs structure to fill. > + * > + * @param devstr > + * Device string. > + * > + * @return > + * 0 on success. > + * Negative errno values on error (rte_errno is set). > + */ > +int > +rte_devargs_layers_parse(struct rte_devargs *da, > + const char *devstr); > + > #endif /* _EAL_PRIVATE_H_ */ > diff --git a/lib/librte_eal/common/include/rte_devargs.h b/lib/librte_eal/common/include/rte_devargs.h > index 6c3b6326b..148600258 100644 > --- a/lib/librte_eal/common/include/rte_devargs.h > +++ b/lib/librte_eal/common/include/rte_devargs.h > @@ -51,12 +51,19 @@ struct rte_devargs { > enum rte_devtype type; > /** Device policy. */ > enum rte_dev_policy policy; > - /** Bus handle for the device. */ > - struct rte_bus *bus; > /** Name of the device. */ > char name[RTE_DEV_NAME_MAX_LEN]; > + RTE_STD_C11 > + union { > /** Arguments string as given by user or "" for no argument. */ > - char *args; > + char *args; > + const char *drvstr; > + }; > + struct rte_bus *bus; /**< bus handle. */ > + struct rte_class *cls; /**< class handle. */ "class" is more readable than "cls" > + const char *busstr; /**< bus-related part of device string. */ bus_str ? > + const char *clsstr; /**< bus-related part of device string. */ class_str ? + there is a typo in the comment (copy/pasted "bus") > + const char *data; /**< Device string storage. */ > };