From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f175.google.com (mail-wr0-f175.google.com [209.85.128.175]) by dpdk.org (Postfix) with ESMTP id C515923C for ; Tue, 24 Apr 2018 12:03:18 +0200 (CEST) Received: by mail-wr0-f175.google.com with SMTP id w3-v6so49035329wrg.2 for ; Tue, 24 Apr 2018 03:03:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=aYgklrbQv7ixIULIVc2kx5BEjPBOMOoJOcfVVzE9fhQ=; b=qQz2VrChqjtsTVAhA7pu91C4GG1yx3LBa3UEdSQaflDo3wIXDkeZO9m/I7BQzIc2+Y Birp7bXbhVGrnbMV9utxgbpgGBIURV1l79FwKvD4QbRcAWfLFh/ygSNM0mf/wKDalhp7 N5zc26vQrnttwzl+Nl9uhWFzYpSrWBKKAB2rfPOKiZvycTsQRBHfGTiSjRaOb5T+n/Pv xjcfgmkuMDCRiJ4FCq7jcP3QxkXZqLEp5Ei38btsmRMVH4cxexLuXFr/py9hgXiFhKQk uEaLNpjLapo57p6UZ3bojx84jCL//5m41FB4JHD4D+sYZwFqSr/53AZRrfb+2Tz3uUlw f8HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=aYgklrbQv7ixIULIVc2kx5BEjPBOMOoJOcfVVzE9fhQ=; b=VhNwDw3cUuoukMZsAuClcGhTavQY8oC8KmIpAcBYUIx82fgo6HDbUn5CbGvQkYR5JA Z7OeuF3L5VB4le/MYouE+pdKm2utdbA8UzSiL9PDgNljjE1r1hX/cDBpI5YRHsXJc/DP pH/XfAIlI27HPRulOQD/8NcgawSxkzEbYPFoSAxAnUYSFXZRqKz07AsUnqzbB9mcRXAL TF9zPcqjNmxtJ7eYpSozm0HDsTqBjMEIFrj0hHjWg923XrkTwn5Iitrf/bBGAapul144 c/x9DdzwLfVUku43kye66RGXbxC8qPADPAiYIGOtHCXGAVhpnXnog0Fjls7bOmT9cP31 cu9Q== X-Gm-Message-State: ALQs6tCkejPHT8UEcxBRvBANSKIAptEQtY3bQn4o2SW5QbSK7GFP11Y4 sdba/Scuh+busGaofMCM+ccC3g== X-Google-Smtp-Source: AIpwx48nfxzZ4eKS9AAdDPhOxc9jbQSWWrgfa0H4ccoJ1z8cR0yRWMb9jNndsJ5FpgXbOFY0/ZcefQ== X-Received: by 2002:adf:c792:: with SMTP id l18-v6mr19816477wrg.224.1524564198152; Tue, 24 Apr 2018 03:03:18 -0700 (PDT) Received: from bidouze.vm.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id g7-v6sm11749575wrb.60.2018.04.24.03.03.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Apr 2018 03:03:17 -0700 (PDT) Date: Tue, 24 Apr 2018 12:03:03 +0200 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: Thomas Monjalon Cc: dev@dpdk.org, Neil Horman , Keith Wiles , Matan Azrad , Shreyansh Jain Message-ID: <20180424100302.wqbppvzdyga4bvos@bidouze.vm.6wind.com> References: <3513274.H18vdlKUql@xps> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3513274.H18vdlKUql@xps> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH v7 00/22] Device querying 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, 24 Apr 2018 10:03:18 -0000 On Mon, Apr 23, 2018 at 12:54:54AM +0200, Thomas Monjalon wrote: > 15/04/2018 17:07, Gaetan Rivet: > > This patchset introduces a new EAL API for querying devices, > > filtered by arbitrary properties. > > > > The following elements are introduced to this end: > > > > * A new object, "rte_class", is used to describe > > the device class abstraction layer (eth, crypto, ...). > > > > * Both rte_bus and rte_class now offer a way to > > list their devices and filter the result > > using locally defined properties. > > > > * The rte_dev API now has an rte_dev_iterator, which > > is the way for the user to define the device filter > > and iterate upon the resulting set. > > > > As an example, the "eth" device class is implemented. > > > > Additionally, the device filters for > > > > + rte_bus_pci > > + rte_bus_vdev > > + rte_class_eth > > > > are implemented and can be used with some > > properties each, to show how to extend those. > > > > Some example of filters: > > > > "bus=pci/class=eth" > > "bus=pci" > > "class=eth" > > "class=eth,name=net_ring0" > > "bus=pci,id=00:00.0" > > "bus=vdev,driver=net_ring" > > Thanks for the very big work Gaetan. > > This series has some cleanups, fixes, and more importantly, > introduces the framework for a generic device syntax. > > I am not clear what is missing in the properties parsing? For properties, parsing is *mostly* done. The general framework is there for other devs to populate as they see fit. A thing that will arise when doing so, is that librte_kvargs is somewhat cumbersome to use as it is, when the "/" character is not considered "end-of-string". This adds cruft in a lot of places otherwise. So I think we need to add some way to configure this (or even have this behavior by default). Otherwise most things are available. > In various buses and classes implementations? > > Are we close of the next step, revisiting -w/-b and --vdev options? > I started this part to see the scope. It's quite large. I have issues with the current device declaration syntax, that needs to be discussed. 1. One issue is that buses are working on a best-effort basis to probe drivers. When the "driver=" layer is given, a driver is then explicitly choosen by the user. This contradicts the current bus logic. The "driver" layer is necessary to give any device parameters, and choosing the proper driver beforehand seems user-hostile. I think the "driver=" part should actually be dropped altogether, which would simplify the declaration. We'll see if another solution can be attained. 2. A second issue is regarding the standing of the "class" layer. The parsing of devices goes like this: 0. bus, class and driver is parsed and put in its relevant part in the devargs. 1. Bus parses the devargs and uses its part within it (necessary to find the proper device identifier for example). 2. Bus probes all drivers to find the one able to handle the device. At this point, the devargs is passed down to the driver, with all three layers (bus, class, driver) parts. Driver uses the driver part for its initialization. 3. Driver calls the device creation function of a class (passing the devargs), for example to spawn an rte_eth_dev. The class thus parses the class part of the devargs and uses it for initialization. In matter of layer hierarchy, this is not neat and clean: bus -> driver -> class. Drivers are the one having to choose whether to spawn an eth or crypto of compress device (or any other, in any numbers). Having the class initialize after the driver however seems prone to conflicts in configuration (between the hardware init and the higher device class properties for example). Another issue that I sidestepped in the device ident, is how to recognize and handle ambiguous device declarations. Something like: --dev bus=pci would thus match all PCI devices on the system. All would be probed (akin to blacklist mode), with default parameters. Not aberrant. However something like --dev class=eth does not mean anything. This cannot be recognized at devargs parsing time. Such devargs would not actually identify a specific device on a bus. PCI might be able to handle such case, vdev not. Other buses might not as well. So I think it is necessary that at least the bus identifier is given. The bus identifier is a bus property that is bus-specific: for PCI it is the "id" property. For vdev it is "driver" (for driver name). This is not user-friendly. Requiring the bus identifier is not actually, but this is what was implicitly done by the current devargs "name" field. But let's think about possible secondary properties: for example, in PCI bus the vendor id could be a property. Should a devargs "bus=pci,vendor=0x8086" be accepted, as a set of PCI device could actually be matched? If multiple devices match the devargs, should the devargs be cloned for each? I'm tempted to say no, for the sake of simplicity, but this might be worth thinking about it. So, as you see, this work is far from done and there are standing issues that will I think require some discussion from the community. -- Gaëtan Rivet 6WIND