From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gaetan.rivet@6wind.com>
Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52])
 by dpdk.org (Postfix) with ESMTP id 87C69376C
 for <dev@dpdk.org>; Mon, 17 Jul 2017 17:52:36 +0200 (CEST)
Received: by mail-wm0-f52.google.com with SMTP id b134so52639680wma.0
 for <dev@dpdk.org>; Mon, 17 Jul 2017 08:52:36 -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=GgBxjUDrIkKTh8FwDYrrn5zYqLqPQcnwMY4tOM5fv9k=;
 b=jh6Mx7A35PYGiJwWGJshBvxB6GuXlBICNthkJdFSmQww+etCnlSsZDExUT7dVnZZoP
 GZvPT8QJD5yzE6MJHo6NVbt947s2GJwacqX3iaLwDtqQGgC5pF+JrOytDm7rRAzj22AC
 whhj/7ltMIF1piuwFcw4mu0CgUufys6pq5i61MVP4PwwBuzBJ3yy8rYBpHz5juwTZSBN
 0b/3pgejQYJOskvbnz19uV7IHOKTK3S8X5CFw4nh2oC+3ycVTGMOChGFFmNoPJw3wHDI
 MZRsfDStwY18yXekwpmTTYdKTO2d6DrGl5dLk++uH/qiSTXYNRTeDo0IrBWvagwoLDfU
 C/1Q==
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=GgBxjUDrIkKTh8FwDYrrn5zYqLqPQcnwMY4tOM5fv9k=;
 b=OWrWabjaq+/ry9MCZf7DZUiE8xR1QglhxjJYDkkWVIICfQFhDmaEKp4IRzzd1qLlof
 IXrpKFzTfBTMClMPOhLBpRvV/+2WcKECWVwVHA7lmK4yOKpwQowUyh2nfvmr4xv5vccu
 Ys2vmp+792cyT6h5GCR/YuzrvuNQLSzmblNvtgWPeLoih/UJbynqwQ/zeYMix2q4DNos
 62f524h9gDs4leQwAWSanS0XnwDmXTkjujTpyldRdnmVDmJWZrzI+JhFC6Kcytqv0dfT
 uPcQlbd+aZCocLEvKx/lkz5xIYCPOj7wazcbXi5opiRJBnuN3Sd+ygL8OhqTZek7fIER
 tCOw==
X-Gm-Message-State: AIVw1125JeF1DyXQLOUV+6kzs2v30xu307xkbwVyF3Kz+kM+4a926di+
 oF1XED7ZfDbSZUR1
X-Received: by 10.28.136.147 with SMTP id k141mr4045556wmd.14.1500306756004;
 Mon, 17 Jul 2017 08:52:36 -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 o131sm12992992wmd.26.2017.07.17.08.52.34
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 17 Jul 2017 08:52:35 -0700 (PDT)
Date: Mon, 17 Jul 2017 17:52:26 +0200
From: =?iso-8859-1?Q?Ga=EBtan?= Rivet <gaetan.rivet@6wind.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: dev@dpdk.org
Message-ID: <20170717155226.GQ11154@bidouze.vm.6wind.com>
References: <cover.1500130634.git.gaetan.rivet@6wind.com>
 <b337b8afcd9b789931907e0f9e96f21d6ade3792.1500130635.git.gaetan.rivet@6wind.com>
 <f72b4db1-e207-70c1-80c7-2877e761305f@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <f72b4db1-e207-70c1-80c7-2877e761305f@intel.com>
User-Agent: Mutt/1.5.23 (2014-03-12)
Subject: Re: [dpdk-dev] [PATCH v10 05/11] net/failsafe: add flexible device
 definition
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 17 Jul 2017 15:52:36 -0000

Hi Ferruh,

(Thanks for the review by the way, I will answer the other more lengthy
emails in due time)

On Mon, Jul 17, 2017 at 04:45:59PM +0100, Ferruh Yigit wrote:
> On 7/15/2017 6:57 PM, Gaetan Rivet wrote:
> > Add the "exec" device type.
> > The parameters given to this type of device will be executed in a shell.
> > The output of this command is then used as a definition for a device.
> > 
> > That command can be re-interpreted if the related device is not
> > plugged-in. It allows for a device definition to react to system
> > changes (e.g. changing PCI bus for a given device).
> > 
> > Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
> > Acked-by: Olga Shern <olgas@mellanox.com>
> > ---
> >  doc/guides/nics/fail_safe.rst           | 20 +++++++
> >  drivers/net/failsafe/failsafe_args.c    | 95 +++++++++++++++++++++++++++++++++
> >  drivers/net/failsafe/failsafe_ether.c   |  7 +++
> >  drivers/net/failsafe/failsafe_private.h |  4 ++
> >  4 files changed, 126 insertions(+)
> > 
> > diff --git a/doc/guides/nics/fail_safe.rst b/doc/guides/nics/fail_safe.rst
> > index 5ec3031..be73d7e 100644
> > --- a/doc/guides/nics/fail_safe.rst
> > +++ b/doc/guides/nics/fail_safe.rst
> > @@ -87,6 +87,19 @@ Fail-safe command line parameters
> >    additional sub-device parameters if need be. They will be passed on to the
> >    sub-device.
> >  
> > +- **exec(<shell command>)** parameter
> > +
> > +  This parameter allows the user to provide a command to the fail-safe PMD to
> > +  execute and define a sub-device.
> > +  It is done within a regular shell context.
> > +  The first line of its output is read by the fail-safe PMD and otherwise
> > +  interpreted as if passed by the regular **dev** parameter.
> > +  Any other line is discarded.
> > +  If the command fail or output an incorrect string, the sub-device is not
> > +  initialized.
> > +  All commas within the ``shell command`` are replaced by spaces before
> > +  executing the command. This helps using scripts to specify devices.
> > +
> >  - **mac** parameter [MAC address]
> >  
> >    This parameter allows the user to set a default MAC address to the fail-safe
> > @@ -135,6 +148,13 @@ This section shows some example of using **testpmd** with a fail-safe PMD.
> >           -w 'net_failsafe0,mac=de:ad:be:ef:01:02,dev(84:00.0),dev(net_ring0)'
> >           -w 81:00.0 -- -i
> >  
> > +#. Start testpmd using a flexible device definition
> > +
> > +   .. code-block:: console
> > +
> > +      $RTE_TARGET/build/app/testpmd -c 0xff -n 4 --no-pci \
> > +         --vdev='net_failsafe0,exec(echo 84:00.0)' -- -i
> 
> Hi Gaetan,
> 
> What is the usecase for this feature.
> 
> How this is different from --vdev='net_failsafe0,dev(`echo 84:00.0`)' ?

This version would be interpreted once, at the launch of the fail-safe
PMD.

The exec option will execute the command again each time the fail-safe
tries to probe the sub_device. This means that in a live VM migration
context, the sub_device can change PCI address (for example), and still be
matched by the command using other identifying info (MAC address,
class_id, ...).

It must be reinterpreted upon plugin of the sub_device,
as the output would change from the time the fail-safe was started.

-- 
Gaƫtan Rivet
6WIND