From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1ECDEA0524; Sat, 4 Jul 2020 16:44:25 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1E50B1DB95; Sat, 4 Jul 2020 16:44:24 +0200 (CEST) Received: from mail-oi1-f196.google.com (mail-oi1-f196.google.com [209.85.167.196]) by dpdk.org (Postfix) with ESMTP id CAF4A1DB92 for ; Sat, 4 Jul 2020 16:44:21 +0200 (CEST) Received: by mail-oi1-f196.google.com with SMTP id x83so21193453oif.10 for ; Sat, 04 Jul 2020 07:44:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4Q2kzTTu9e4+6vHid6Tzze+AkWvTnBquvMbXOtek6gM=; b=DR4ZCBmCLX3UidhikOBLPzS1zLF46PbyPLiAor4ui+iVpnrGwFDeyPzd9nKcIl6+tm L4YI1lpi8xSObrg8JeJp3QrQhnOCLcqasSp8efT7nuzgys9UimUS6xwSBHptuWFA8fFD cUO+n3ynnWDkzuq1N3sGSzAbRy79xUHYSxQ98= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4Q2kzTTu9e4+6vHid6Tzze+AkWvTnBquvMbXOtek6gM=; b=nwUDgY8GTYe2JaAf7MlOghEnbXXfTefmKWZC4snnCXxMqT/yUkpiAgnXoUt/ld2rzD mM4xzC1phsCzcaKS8w13zgNU9KhkdMw9WHE85NuNBJ6EIwBUUHjhGnx4MyLYLbXYiUgg XNYmsC5uSQOeP1Lfwno2uVLd7zEnIIDm/nmsvn+buwzifKheEVG5Ek/l2YL0nG+fn8lq kfAzLqOrcSJGL+m3u8IsYgc/pXsW5ceC1U27JEag4XIDpNUPcqaQg4ck3kE/CExuHgSB akecS+Tew8RXRDAh07wAL4ZgVKXkD9moJ8B+lgWaqF20dMIX6N0Rfdv/DADjlaqV1oBQ u/eg== X-Gm-Message-State: AOAM5304Z5lp6yYrr2hNRQmH885HbDaGegEogCMTBHwv7Zb8mH3Pt6X2 QWwccdnEogcfbkGPkZFoRTf577bmlqMUQbat2NalDw== X-Google-Smtp-Source: ABdhPJz6vxmgIm2dmR9uC42R/oMWHMNmvgUoiYq2Z/Ly27XRoXZ4fX05bMxaedUaqj+ur6+9378+3/1q/M119ZR006w= X-Received: by 2002:a05:6808:6ca:: with SMTP id m10mr31620056oih.27.1593873860711; Sat, 04 Jul 2020 07:44:20 -0700 (PDT) MIME-Version: 1.0 References: <1593102379-400132-1-git-send-email-jiaweiw@mellanox.com> <1593715390-83047-1-git-send-email-jiaweiw@mellanox.com> <1593715390-83047-2-git-send-email-jiaweiw@mellanox.com> In-Reply-To: From: Ajit Khaparde Date: Sat, 4 Jul 2020 07:44:04 -0700 Message-ID: To: Jerin Jacob Cc: Jiawei Wang , Ori Kam , Slava Ovsiienko , Matan Azrad , dpdk-dev , Thomas Monjalon , Raslan Darawsheh , ian.stokes@intel.com, fbl@redhat.com Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v2 1/7] ethdev: introduce sample action for rte flow 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" On Thu, Jul 2, 2020 at 11:40 PM Jerin Jacob wrote: > On Fri, Jul 3, 2020 at 12:13 AM Jiawei Wang wrote: > > > > When using full offload, all traffic will be handled by the HW, and > > directed to the requested vf or wire, the control application loses > > visibility on the traffic. > > So there's a need for an action that will enable the control application > > some visibility. > > > > The solution is introduced a new action that will sample the incoming > > traffic and send a duplicated traffic in some predefined ratio to the > > application, while the original packet will continue to the target > > destination. > > > > The packets sampled equals is '1/ratio', if the ratio value be set to 1 > > , means that the packets would be completely mirrored. The sample packet > > can be assigned with different set of actions from the original packet. > > > > In order to support the sample packet in rte_flow, new rte_flow action > > definition RTE_FLOW_ACTION_TYPE_SAMPLE and structure > rte_flow_action_sample > > will be introduced. > > > > Signed-off-by: Jiawei Wang > > Acked-by: Ori Kam > > When adding overlapping API(rte_eth_mirror_rule_set()) in the same > library(ethdev). > Please depreciate the old API. > We should not have two separate paths for the same function in the > same ethdev library. It is pain for app and driver developers. > > With the above deprecation notice, > Acked-by: Jerin Jacob > I am fine with the proposed RTE_FLOW_ACTION_TYPE_SAMPLE. But.. When rte_eth_mirror_rule_set() is deprecated, are we going to add RTE_FLOW_ACTION_TYPE_MIRROR for full fledged mirror action? Or we are proposing to use RTE_FLOW_ACTION_TYPE_SAMPLE with ratio of 1 to mirror all packets, thereby doing away with the need for a separate RTE_FLOW_ACTION_TYPE_MIRROR? > > > > --- > > doc/guides/prog_guide/rte_flow.rst | 25 +++++++++++++++++++++++++ > > doc/guides/rel_notes/release_20_08.rst | 6 ++++++ > > lib/librte_ethdev/rte_flow.c | 1 + > > lib/librte_ethdev/rte_flow.h | 28 ++++++++++++++++++++++++++++ > > 4 files changed, 60 insertions(+) > > > > diff --git a/doc/guides/prog_guide/rte_flow.rst > b/doc/guides/prog_guide/rte_flow.rst > > index d5dd18c..50dfe1f 100644 > > --- a/doc/guides/prog_guide/rte_flow.rst > > +++ b/doc/guides/prog_guide/rte_flow.rst > > @@ -2645,6 +2645,31 @@ timeout passed without any matching on the flow. > > | ``context`` | user input flow context | > > +--------------+---------------------------------+ > > > > +Action: ``SAMPLE`` > > +^^^^^^^^^^^^^^^^^^ > > + > > +Adds a sample action to a matched flow. > > + > > +The matching packets will be duplicated to a special queue or vport > > +with the predefined ``ratio``, the packets sampled equals is '1/ratio'. > > +All the packets continues to the target destination. > > + > > +When the ``ratio`` is set to 1 then the packets will be 100% mirrored. > > +``actions`` represent the different set of actions for the sampled or > mirrored > > +packets. > > + > > +.. _table_rte_flow_action_sample: > > + > > +.. table:: SAMPLE > > + > > + +--------------+---------------------------------+ > > + | Field | Value | > > + +==============+=================================+ > > + | ``ratio`` | 32 bits sample ratio value | > > + +--------------+---------------------------------+ > > + | ``actions`` | sub-action list for sampling | > > + +--------------+---------------------------------+ > > + > > Negative types > > ~~~~~~~~~~~~~~ > > > > diff --git a/doc/guides/rel_notes/release_20_08.rst > b/doc/guides/rel_notes/release_20_08.rst > > index 5cbc4ce..313e8d3 100644 > > --- a/doc/guides/rel_notes/release_20_08.rst > > +++ b/doc/guides/rel_notes/release_20_08.rst > > @@ -81,6 +81,12 @@ New Features > > * Added support for virtio queue statistics. > > * Added support for MTU update. > > > > +* **Added flow-based traffic sampling support.** > > + > > + Added new action: ``RTE_FLOW_ACTION_TYPE_SAMPLE`` to duplicate the > matching > > + packets with given ratio and redirects to vport or queue. The sampled > packets > > + also can be assigned with an additional optional actions. > > + > > * **Updated Marvell octeontx2 ethdev PMD.** > > > > Updated Marvell octeontx2 driver with cn98xx support. > > diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c > > index 1685be5..733871d 100644 > > --- a/lib/librte_ethdev/rte_flow.c > > +++ b/lib/librte_ethdev/rte_flow.c > > @@ -173,6 +173,7 @@ struct rte_flow_desc_data { > > MK_FLOW_ACTION(SET_IPV4_DSCP, sizeof(struct > rte_flow_action_set_dscp)), > > MK_FLOW_ACTION(SET_IPV6_DSCP, sizeof(struct > rte_flow_action_set_dscp)), > > MK_FLOW_ACTION(AGE, sizeof(struct rte_flow_action_age)), > > + MK_FLOW_ACTION(SAMPLE, sizeof(struct rte_flow_action_sample)), > > }; > > > > int > > diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h > > index b0e4199..c9cd80d 100644 > > --- a/lib/librte_ethdev/rte_flow.h > > +++ b/lib/librte_ethdev/rte_flow.h > > @@ -2099,6 +2099,13 @@ enum rte_flow_action_type { > > * see enum RTE_ETH_EVENT_FLOW_AGED > > */ > > RTE_FLOW_ACTION_TYPE_AGE, > > + > > + /** > > + * Redirects specific ratio of packets to vport or queue. > > + * > > + * See struct rte_flow_action_sample. > > + */ > > + RTE_FLOW_ACTION_TYPE_SAMPLE, > > }; > > > > /** > > @@ -2709,6 +2716,27 @@ struct rte_flow_action { > > struct rte_flow; > > > > /** > > + * @warning > > + * @b EXPERIMENTAL: this structure may change without prior notice > > + * > > + * RTE_FLOW_ACTION_TYPE_SAMPLE > > + * > > + * Adds a sample action to a matched flow. > > + * > > + * The matching packets will be duplicated to a special queue or vport > > + * in the predefined probabiilty, All the packets continues processing > > + * on the default flow path. > > + * > > + * When the sample ratio is set to 1 then the packets will be 100% > mirrored. > > + * Additional action list be supported to add for sampled or mirrored > packets. > > + */ > > +struct rte_flow_action_sample { > > + const uint32_t ratio; /**< packets sampled equals to '1/ratio'. > */ > > + const struct rte_flow_action *actions; > > + /**< sub-action list specific for the sampling hit > cases. */ > > +}; > > + > > +/** > > * Verbose error types. > > * > > * Most of them provide the type of the object referenced by struct > > -- > > 1.8.3.1 > > >