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 164BCA0523; Thu, 2 Jul 2020 02:18:25 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4E94E1D5C8; Thu, 2 Jul 2020 02:18:24 +0200 (CEST) Received: from mail-pj1-f68.google.com (mail-pj1-f68.google.com [209.85.216.68]) by dpdk.org (Postfix) with ESMTP id 38FF41D5C7 for ; Thu, 2 Jul 2020 02:18:23 +0200 (CEST) Received: by mail-pj1-f68.google.com with SMTP id gc9so5148416pjb.2 for ; Wed, 01 Jul 2020 17:18:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qeJKbsw8wO8nLHVQH7hztvRSWbPlpB9+bDC06RR7Gig=; b=K1W0ZXCZfDsjlI4GvsPD4vjwZDDrd+p0fJULMfRrJLuIYdI9i4Rvd2ImMjyzF0qLLN u3oaILlO4ugy1ykzL4eK4pQynfCsq0XC3MHNBLt1SByCv9n2jZrHHlLI5gAxnpLVYSgQ z038fAvUKqSiO4UH2UVmNHz75Yi1ICtVLALRMoirD2VElSMMIOUiLSp3OQNP8uIERPk+ iqIHBPNAfyc3X4IZj4cqlcNj3mss17Bc/oSwgbLhCTP4sAPvJfnSV98DH0xsXPaGWLFc cjsG91jK0m/9/nSwcz1uGYMQRMQgae8BDMY2WskWoqYBkOmnAknpw0XBbUjgVR8fMu04 obvg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=qeJKbsw8wO8nLHVQH7hztvRSWbPlpB9+bDC06RR7Gig=; b=d692d1Xy3MAF9NC4ui3eLhqsG0gGaOxAQhiMDczI5GknPBNIMeJLaBY6VfSL68AqlA eRoLFlrPSifG8sY1WV9E+OckBLPhocSZhmJziHWdWh+Xi/MuivQBmG/xNNT9dlYpVOoG P3uJ/lQIsNiXWqIvtRyvr16px2AM2EWhnk0cnNjJbMDMsQ97nceJSN+DWNAdeOJsf2Ow SCkEK8UiTlbb0BIr4cJxNW1Hp2FYKTo7vHBPrLooPwJV0nWKUBZR80UoQ1Tc6lHJmqsj vDXj46nDV+8+xB/PxZYpafZ0mU5zCqvGCEA6WdgEyj2afW3ggZLzqfonXlRIamjGM+K9 vuNw== X-Gm-Message-State: AOAM531e53scorn+v4XNCzQ9yaMsI2hTUZ+ofB0T++jAW1ZjDnWRwwON fNYnT3qMv9ccaIPhYrriOQtm+g== X-Google-Smtp-Source: ABdhPJydsrHSbfGF6lj9bkAb5eM2wPYwlzgculeTxYxD8G8pLFkWyfCnfwQPKwUjErPwrs5Pu5O09w== X-Received: by 2002:a17:902:c206:: with SMTP id 6mr10755368pll.268.1593649102228; Wed, 01 Jul 2020 17:18:22 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id 8sm6313829pja.0.2020.07.01.17.18.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jul 2020 17:18:21 -0700 (PDT) Date: Wed, 1 Jul 2020 17:18:12 -0700 From: Stephen Hemminger To: "Jiawei(Jonny) Wang" Cc: Jerin Jacob , Thomas Monjalon , Ori Kam , Slava Ovsiienko , Matan Azrad , dpdk-dev , Raslan Darawsheh , "ian.stokes@intel.com" , "fbl@redhat.com" , Ferruh Yigit , Andrew Rybchenko Message-ID: <20200701171812.075ead92@hermes.lan> In-Reply-To: References: <1593102379-400132-1-git-send-email-jiaweiw@mellanox.com> <17660414.AQMWyGVKyv@thomas> <7719744.nB5e5IOROX@thomas> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [PATCH 1/8] 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 Sun, 28 Jun 2020 15:52:27 +0000 "Jiawei(Jonny) Wang" wrote: > > -----Original Message----- > > From: Jerin Jacob > > Sent: Sunday, June 28, 2020 9:38 PM > > To: Jiawei(Jonny) Wang > > Cc: Thomas Monjalon ; Ori Kam > > ; Slava Ovsiienko ; > > Matan Azrad ; dpdk-dev ; Raslan > > Darawsheh ; ian.stokes@intel.com; > > fbl@redhat.com; Ferruh Yigit ; Andrew Rybchenko > > > > Subject: Re: [dpdk-dev] [PATCH 1/8] ethdev: introduce sample action for= rte > > flow > >=20 > > On Sun, Jun 28, 2020 at 6:46 PM Jiawei(Jonny) Wang > > wrote: =20 > > > > > > > > > On Friday, June 26, 2020 7:10 PM Jerin Jacob = =20 > > Wrote: =20 > > > > > > > > On Fri, Jun 26, 2020 at 4:16 PM Thomas Monjalon > > > > > > > > wrote: =20 > > > > > > > > > > 26/06/2020 12:35, Jerin Jacob: =20 > > > > > > On Fri, Jun 26, 2020 at 12:59 AM Thomas Monjalon =20 > > > > wrote: =20 > > > > > > > > > > > > > > 25/06/2020 19:55, Jerin Jacob: =20 > > > > > > > > On Thu, Jun 25, 2020 at 10:20 PM Jiawei Wang =20 > > > > wrote: =20 > > > > > > > > > > > > > > > > > > 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 =20 > > > > actions from the original packet. =20 > > > > > > > > > > > > > > > > > > In order to support the sample packet in rte_flow, new > > > > > > > > > rte_flow action definition RTE_FLOW_ACTION_TYPE_SAMPLE =20 > > and =20 > > > > > > > > > structure rte_flow_action_sample =20 > > > > > > > > > > > > > > > > Isn't mirroring the packet? How about, > > > > > > > > RTE_FLOW_ACTION_TYPE_MIRROR I am not able to understand, =20 > > Why =20 > > > > it is called sample. =20 > > > > > > > > > > > > > > Sampling is a partial mirroring. =20 > > > > > > > > > > > > I think, By definition, _sampling_ is the _selection_ of items > > > > > > from a specific group. > > > > > > I think, _sampling_ is not dictating, what is the real action > > > > > > for the "selected" items. > > > > > > One can get confused with the selected ones can be for forward, > > > > > > drop any other action. =20 > > > > > > > > > > I see. Good design question (I will let others reply). > > > > > =20 > > > > > > So IMO, explicit mirror keyword usage makes it is clear. =20 > > > > > > Sampled packet is duplicated from incoming traffic at specific ratio > > > and will go to different sample actions; > > > ratio=3D1 is 100% duplication or mirroring. > > > All packets will continue to go to default flow actions. =20 > >=20 > > Functionality is clear from the git commit log(Not from action name). > > The only question is what would be the appropriate name for this action. > > RTE_FLOW_ACTION_TYPE_SAMPLE vs RTE_FLOW_ACTION_TYPE_MIRROR > > =20 > > > =20 > > > > > > > > > > > > Some more related questions: > > > > > > 1) What is the real use case for ratio? I am not against adding > > > > > > a ratio attribute if the MLX hardware supports it. It will be > > > > > > good to know the use case from the application perspective? And > > > > > > what basics application set ratio !=3D 1? =20 > > > > > > > > > > If I understand well, some applications want to check, by picking > > > > > random packets, that the processing is not failing. =20 > > > > > > > > Not clear to me. I will wait for another explanation if any. > > > > In what basics application set .1 vs .8? =20 > > > > > > The real case is like monitor the traffic with full-offload. > > > While packet hit the sample flow, the matching packets will be sampled > > > and sent to specific Queue, align with OVS sflow probability, user =20 > > application can set it different value. > >=20 > > I understand the use case for mirror and supported in a lot of HW. > > What I would like to understand is the use case for "ratio"? > > Is the "ratio" part of OpenFlow spec? Or Is it an MLX hardware feature? > > =20 > The same usage of the 'probability' variable of ovs sample action; > MLX HW implemented it. > >=20 > > =20 > > > =20 > > > > =20 > > > > > =20 > > > > > > 2) If it is for "rate-limiting" or "policing", why not use > > > > > > rte_mtr object (rte_mtr.h) via rte_flow action. =20 > > > > > > The sample ratio isn=E2=80=99t the same as =E2=80=9Cmeter=E2=80=99, t= he ratio of sampling will be =20 > > calculated with incoming packets mask (every some packets sampled 1). > > Then the packets will be duplicated and go to do the other sample actio= ns. > >=20 > > What I meant here is , If the ratio is used for rate-limiting then havi= ng a > > cascade rule like RTE_FLOW_ACTION_TYPE_MIRROR, > > RTE_FLOW_ACTION_TYPE_MTR will do the job. > > =20 > The ratio means the probability with packet replication, we don't need ad= d METER action here. > > > > > > =20 > > > > > > 3) One of the issue for driver developers and application > > > > > > writers are overlapping APIs. This would overlap with > > > > > > rte_eth_mirror_rule_set() API. > > > > > > > > > > > > Can we deprecate rte_eth_mirror_rule_set() API? It will be a > > > > > > pain for all to have overlapping APIs. We have not fixed the > > > > > > VLAN filter API overlap with rte_flow in ethdev. Its being TODO > > > > > > for multiple releases now. =20 > > > > > > > > > > Ooooooooh yes! > > > > > I think flow-based API is more powerful, and should deprecate old > > > > > port-based API. =20 > > > > > > > > +1 from me. > > > > > > > > it is taking too much effort and time to make support duplicate API= s. > > > > =20 > > > > > I want to help deprecating such API in 20.11 if possible. =20 > > > > > > > > Please start that discussion. In this case, it is clear API overlap > > > > with rte_eth_mirror_rule_set(). > > > > We should not have two separate paths for the same function in the > > > > same ethdev library. > > > > > > > > > > > > =20 > > > > > =20 > > > > > > > Full mirroring is sampling 100% packets (ratio =3D 1). > > > > > > > That's why only one action is enough. =20 > > > > > > > > > > > > > > > =20 One use case would be simulating packet loss or duplication. (like netem do= es). In that use case, the sample action would have to not have an implicit copy. Could sample be defined as "if random number hits the ratio" then execute this alternative rule, otherwise go to next rule. The the alternative rule could mirror if it wanted, or drop, or count, or .= .. It could even be used as a form of transmit load balancing.