DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] doc: add sampling and mirroring in testpmd guide
@ 2021-03-09 13:18 Jiawei Wang
  2021-03-25 17:10 ` Ferruh Yigit
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Jiawei Wang @ 2021-03-09 13:18 UTC (permalink / raw)
  To: viacheslavo, xiaoyun.li, ferruh.yigit; +Cc: dev

Update documentation for sample action usage in testpmd and
show the command line example.

Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 60 +++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)

diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index f59eb8a..3a31cc6 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -2003,6 +2003,24 @@ Set fec mode for a specific port::
 
   testpmd> set port (port_id) fec_mode auto|off|rs|baser
 
+Config Sample actions list
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Configure the sample actions list to be used when sampling a packet by
+rte_flow_action_sample::
+
+ set sample_actions {index} {action} [/ {action} [...]] / end
+
+There are multiple global buffers for ``sample_actions``, this command will set
+one internal buffer index by ``{index}``.
+
+In order to use different sample actions list, ``index`` must be specified
+during the flow rule creation::
+
+ testpmd> flow create 0 ingress pattern eth / ipv4 / end actions
+        sample ratio 2 index 2 / end
+
+Otherwise the default index ``0`` is used.
 
 Port Functions
 --------------
@@ -4841,6 +4859,48 @@ if seid is set)::
  testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 1
         seid is 1 / end actions queue index 3 / end
 
+Sample Sampling/Mirroring rules
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Sample/Mirroring rules can be set by the following commands
+
+NIC-RX Sampling rule, the matched ingress packets are duplicated and sent to
+the queue 1, and each second packets are marked with 0x1234 and sent to
+queue 0.
+
+::
+
+ testpmd> set sample_actions 0 mark id  0x1234 / queue index 0 / end
+ testpmd> flow create 0 ingress group 1 pattern eth / end actions
+        sample ratio 2 index 0 / queue index 1 / end
+
+E-Switch Sampling rule, the matched ingress packets are duplicated and sent
+to port id 2, and each second packets are sent to eswitch manager.
+
+::
+
+ testpmd> set sample_actions 0 / end
+ testpmd> flow create 0 ingress transfer pattern eth / end actions
+        sample ratio 2 index 0 / port_id id 2 / end
+
+E-Switch Mirroring rule, the matched ingress packets with encapsulation header
+are sent to port id 0, and also mirrored the packets and sent to port id 2.
+
+::
+
+ testpmd> set sample_actions 0 port_id id 2 / end
+ testpmd> flow create 1 ingress transfer pattern eth / end actions
+        sample ratio 1 index 0  / raw_encap / port_id id 0 / end
+
+E-Switch Mirroring rule, the matched ingress packets are sent to port id 2,
+and also mirrored the packets with encapsulation header and sent to port id 0.
+
+::
+
+ testpmd> set sample_actions 0 raw_encap / port_id id 0 / end
+ testpmd> flow create 0 ingress transfer pattern eth / end actions
+        sample ratio 1 index 0  / port_id id 2 / end
+
 BPF Functions
 --------------
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH] doc: add sampling and mirroring in testpmd guide
  2021-03-09 13:18 [dpdk-dev] [PATCH] doc: add sampling and mirroring in testpmd guide Jiawei Wang
@ 2021-03-25 17:10 ` Ferruh Yigit
  2021-03-25 17:15   ` Thomas Monjalon
  2021-03-31  6:38   ` Jiawei(Jonny) Wang
  2021-03-31  8:51 ` [dpdk-dev] [PATCH v2] " Jiawei Wang
  2021-04-01  2:39 ` [dpdk-dev] [PATCH v3] " Jiawei Wang
  2 siblings, 2 replies; 11+ messages in thread
From: Ferruh Yigit @ 2021-03-25 17:10 UTC (permalink / raw)
  To: Jiawei Wang, viacheslavo, xiaoyun.li, Ori Kam
  Cc: dev, Andrew Rybchenko, Thomas Monjalon

On 3/9/2021 1:18 PM, Jiawei Wang wrote:
> Update documentation for sample action usage in testpmd and
> show the command line example.
> 

+1 to document this.

Indeed for all testpmd flow update, it must be mandatory to update "Flow rules 
management" section for it, Ori what do you think?

> Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

<...>

> +Sample Sampling/Mirroring rules
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +Sample/Mirroring rules can be set by the following commands
> +
> +NIC-RX Sampling rule, the matched ingress packets are duplicated and sent to
> +the queue 1, and each second packets are marked with 0x1234 and sent to
> +queue 0.
> +

Also each second packets duplicated to queue 1, isn't it, because of 'ratio 2'?

> +::
> +
> + testpmd> set sample_actions 0 mark id  0x1234 / queue index 0 / end
> + testpmd> flow create 0 ingress group 1 pattern eth / end actions
> +        sample ratio 2 index 0 / queue index 1 / end
> +
> +E-Switch Sampling rule, the matched ingress packets are duplicated and sent
> +to port id 2, and each second packets are sent to eswitch manager.
> +

what is 'E-Switch', or "eswitch manager", isn't the mirror rule generic?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH] doc: add sampling and mirroring in testpmd guide
  2021-03-25 17:10 ` Ferruh Yigit
@ 2021-03-25 17:15   ` Thomas Monjalon
  2021-03-31  6:58     ` Jiawei(Jonny) Wang
  2021-03-31  6:38   ` Jiawei(Jonny) Wang
  1 sibling, 1 reply; 11+ messages in thread
From: Thomas Monjalon @ 2021-03-25 17:15 UTC (permalink / raw)
  To: Jiawei Wang, viacheslavo, Ori Kam, Ferruh Yigit
  Cc: xiaoyun.li, dev, Andrew Rybchenko

25/03/2021 18:10, Ferruh Yigit:
> On 3/9/2021 1:18 PM, Jiawei Wang wrote:
> > Update documentation for sample action usage in testpmd and
> > show the command line example.
> > 
> 
> +1 to document this.
> 
> Indeed for all testpmd flow update, it must be mandatory to update "Flow rules 
> management" section for it, Ori what do you think?
> 
> > Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
> > Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> 
> <...>
> 
> > +Sample Sampling/Mirroring rules
> > +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > +
> > +Sample/Mirroring rules can be set by the following commands
> > +
> > +NIC-RX Sampling rule, the matched ingress packets are duplicated and sent to
> > +the queue 1, and each second packets are marked with 0x1234 and sent to
> > +queue 0.
> > +
> 
> Also each second packets duplicated to queue 1, isn't it, because of 'ratio 2'?
> 
> > +::
> > +
> > + testpmd> set sample_actions 0 mark id  0x1234 / queue index 0 / end
> > + testpmd> flow create 0 ingress group 1 pattern eth / end actions
> > +        sample ratio 2 index 0 / queue index 1 / end
> > +
> > +E-Switch Sampling rule, the matched ingress packets are duplicated and sent
> > +to port id 2, and each second packets are sent to eswitch manager.
> > +
> 
> what is 'E-Switch', or "eswitch manager", isn't the mirror rule generic?

This is the HW switch in Mellanox devices.
It should not be mentioned in this generic doc.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH] doc: add sampling and mirroring in testpmd guide
  2021-03-25 17:10 ` Ferruh Yigit
  2021-03-25 17:15   ` Thomas Monjalon
@ 2021-03-31  6:38   ` Jiawei(Jonny) Wang
  2021-03-31  9:44     ` Ferruh Yigit
  1 sibling, 1 reply; 11+ messages in thread
From: Jiawei(Jonny) Wang @ 2021-03-31  6:38 UTC (permalink / raw)
  To: Ferruh Yigit, Slava Ovsiienko, xiaoyun.li, Ori Kam
  Cc: dev, Andrew Rybchenko, NBU-Contact-Thomas Monjalon

Hi Ferruh,

> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Friday, March 26, 2021 1:11 AM
> To: Jiawei(Jonny) Wang <jiaweiw@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; xiaoyun.li@intel.com; Ori Kam
> <orika@nvidia.com>
> Cc: dev@dpdk.org; Andrew Rybchenko <arybchenko@solarflare.com>; NBU-
> Contact-Thomas Monjalon <thomas@monjalon.net>
> Subject: Re: [PATCH] doc: add sampling and mirroring in testpmd guide
> 
> On 3/9/2021 1:18 PM, Jiawei Wang wrote:
> > Update documentation for sample action usage in testpmd and show the
> > command line example.
> >
> 
> +1 to document this.
> 
> Indeed for all testpmd flow update, it must be mandatory to update "Flow
> rules management" section for it, Ori what do you think?
> 
> > Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
> > Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> 
> <...>
> 
> > +Sample Sampling/Mirroring rules
> > +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > +
> > +Sample/Mirroring rules can be set by the following commands
> > +
> > +NIC-RX Sampling rule, the matched ingress packets are duplicated and
> > +sent to the queue 1, and each second packets are marked with 0x1234
> > +and sent to queue 0.
> > +
> 
> Also each second packets duplicated to queue 1, isn't it, because of 'ratio 2'?
> 

Yes, 'ratio=2' means that 50% packet will be sampled.

> > +::
> > +
> > + testpmd> set sample_actions 0 mark id  0x1234 / queue index 0 / end
> > + testpmd> flow create 0 ingress group 1 pattern eth / end actions
> > +        sample ratio 2 index 0 / queue index 1 / end
> > +
> > +E-Switch Sampling rule, the matched ingress packets are duplicated
> > +and sent to port id 2, and each second packets are sent to eswitch
> manager.
> > +
> 
> what is 'E-Switch', or "eswitch manager", isn't the mirror rule generic?

Here E-Switch means 'transfer=1' in flow attribute,  I will remove it since the concept is for Mellanox HW.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH] doc: add sampling and mirroring in testpmd guide
  2021-03-25 17:15   ` Thomas Monjalon
@ 2021-03-31  6:58     ` Jiawei(Jonny) Wang
  0 siblings, 0 replies; 11+ messages in thread
From: Jiawei(Jonny) Wang @ 2021-03-31  6:58 UTC (permalink / raw)
  To: NBU-Contact-Thomas Monjalon, Slava Ovsiienko, Ori Kam, Ferruh Yigit
  Cc: xiaoyun.li, dev, Andrew Rybchenko

Hi Thomas,

> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Friday, March 26, 2021 1:16 AM
> To: Jiawei(Jonny) Wang <jiaweiw@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Ori Kam <orika@nvidia.com>; Ferruh Yigit
> <ferruh.yigit@intel.com>
> Cc: xiaoyun.li@intel.com; dev@dpdk.org; Andrew Rybchenko
> <arybchenko@solarflare.com>
> Subject: Re: [PATCH] doc: add sampling and mirroring in testpmd guide
> 
> 25/03/2021 18:10, Ferruh Yigit:
> > On 3/9/2021 1:18 PM, Jiawei Wang wrote:
> > > Update documentation for sample action usage in testpmd and show the
> > > command line example.
> > >
> >
> > +1 to document this.
> >
> > Indeed for all testpmd flow update, it must be mandatory to update
> > "Flow rules management" section for it, Ori what do you think?
> >
> > > Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
> > > Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> >
> > <...>
> >
> > > +Sample Sampling/Mirroring rules
> > > +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > +
> > > +Sample/Mirroring rules can be set by the following commands
> > > +
> > > +NIC-RX Sampling rule, the matched ingress packets are duplicated
> > > +and sent to the queue 1, and each second packets are marked with
> > > +0x1234 and sent to queue 0.
> > > +
> >
> > Also each second packets duplicated to queue 1, isn't it, because of 'ratio 2'?
> >
> > > +::
> > > +
> > > + testpmd> set sample_actions 0 mark id  0x1234 / queue index 0 /
> > > + testpmd> end flow create 0 ingress group 1 pattern eth / end
> > > + testpmd> actions
> > > +        sample ratio 2 index 0 / queue index 1 / end
> > > +
> > > +E-Switch Sampling rule, the matched ingress packets are duplicated
> > > +and sent to port id 2, and each second packets are sent to eswitch
> manager.
> > > +
> >
> > what is 'E-Switch', or "eswitch manager", isn't the mirror rule generic?
> 
> This is the HW switch in Mellanox devices.
> It should not be mentioned in this generic doc.
> 

Yes, I will remove it and send v2 patch.
Thanks.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH v2] doc: add sampling and mirroring in testpmd guide
  2021-03-09 13:18 [dpdk-dev] [PATCH] doc: add sampling and mirroring in testpmd guide Jiawei Wang
  2021-03-25 17:10 ` Ferruh Yigit
@ 2021-03-31  8:51 ` Jiawei Wang
  2021-04-01  2:39 ` [dpdk-dev] [PATCH v3] " Jiawei Wang
  2 siblings, 0 replies; 11+ messages in thread
From: Jiawei Wang @ 2021-03-31  8:51 UTC (permalink / raw)
  To: viacheslavo, xiaoyun.li, ferruh.yigit, thomas; +Cc: dev

Update documentation for sample action usage in testpmd and
show the command line example.

Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
v2:
* Update the description.
---
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 63 +++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)

diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index f59eb8a..6606433 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -2003,6 +2003,24 @@ Set fec mode for a specific port::
 
   testpmd> set port (port_id) fec_mode auto|off|rs|baser
 
+Config Sample actions list
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Configure the sample actions list to be used when sampling a packet by
+rte_flow_action_sample::
+
+ set sample_actions {index} {action} [/ {action} [...]] / end
+
+There are multiple global buffers for ``sample_actions``, this command will set
+one internal buffer index by ``{index}``.
+
+In order to use different sample actions list, ``index`` must be specified
+during the flow rule creation::
+
+ testpmd> flow create 0 ingress pattern eth / ipv4 / end actions
+        sample ratio 2 index 2 / end
+
+Otherwise the default index ``0`` is used.
 
 Port Functions
 --------------
@@ -4841,6 +4859,51 @@ if seid is set)::
  testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 1
         seid is 1 / end actions queue index 3 / end
 
+Sample Sampling/Mirroring rules
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Sample/Mirroring rules can be set by the following commands
+
+NIC-RX Sampling rule, the matched ingress packets and sent to the queue 1,
+also each second packets are duplicated and marked with 0x1234 and sent to
+queue 0.
+
+::
+
+ testpmd> set sample_actions 0 mark id  0x1234 / queue index 0 / end
+ testpmd> flow create 0 ingress group 1 pattern eth / end actions
+        sample ratio 2 index 0 / queue index 1 / end
+
+Sampling rule with port representors (with "transfer" attribute), the matched
+ingress packets are sent to port id 2, also each second packets are sent to
+PF port.
+
+::
+
+ testpmd> set sample_actions 0 / end
+ testpmd> flow create 0 ingress transfer pattern eth / end actions
+        sample ratio 2 index 0 / port_id id 2 / end
+
+Mirroring rule with port representors (with "transfer" attribute), the matched
+ingress packets with encapsulation header are sent to port id 0, and also
+mirrored the packets and sent to port id 2.
+
+::
+
+ testpmd> set sample_actions 0 port_id id 2 / end
+ testpmd> flow create 1 ingress transfer pattern eth / end actions
+        sample ratio 1 index 0  / raw_encap / port_id id 0 / end
+
+Mirroring rule with port representors (with "transfer" attribute), the matched
+ingress packets are sent to port id 2, and also mirrored the packets with
+encapsulation header and sent to port id 0.
+
+::
+
+ testpmd> set sample_actions 0 raw_encap / port_id id 0 / end
+ testpmd> flow create 0 ingress transfer pattern eth / end actions
+        sample ratio 1 index 0  / port_id id 2 / end
+
 BPF Functions
 --------------
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH] doc: add sampling and mirroring in testpmd guide
  2021-03-31  6:38   ` Jiawei(Jonny) Wang
@ 2021-03-31  9:44     ` Ferruh Yigit
  2021-03-31 14:38       ` Jiawei(Jonny) Wang
  0 siblings, 1 reply; 11+ messages in thread
From: Ferruh Yigit @ 2021-03-31  9:44 UTC (permalink / raw)
  To: Jiawei(Jonny) Wang, Slava Ovsiienko, xiaoyun.li, Ori Kam
  Cc: dev, Andrew Rybchenko, NBU-Contact-Thomas Monjalon

On 3/31/2021 7:38 AM, Jiawei(Jonny) Wang wrote:
> Hi Ferruh,
> 
>> -----Original Message-----
>> From: Ferruh Yigit <ferruh.yigit@intel.com>
>> Sent: Friday, March 26, 2021 1:11 AM
>> To: Jiawei(Jonny) Wang <jiaweiw@nvidia.com>; Slava Ovsiienko
>> <viacheslavo@nvidia.com>; xiaoyun.li@intel.com; Ori Kam
>> <orika@nvidia.com>
>> Cc: dev@dpdk.org; Andrew Rybchenko <arybchenko@solarflare.com>; NBU-
>> Contact-Thomas Monjalon <thomas@monjalon.net>
>> Subject: Re: [PATCH] doc: add sampling and mirroring in testpmd guide
>>
>> On 3/9/2021 1:18 PM, Jiawei Wang wrote:
>>> Update documentation for sample action usage in testpmd and show the
>>> command line example.
>>>
>>
>> +1 to document this.
>>
>> Indeed for all testpmd flow update, it must be mandatory to update "Flow
>> rules management" section for it, Ori what do you think?
>>
>>> Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
>>> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
>>
>> <...>
>>
>>> +Sample Sampling/Mirroring rules
>>> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> +
>>> +Sample/Mirroring rules can be set by the following commands
>>> +
>>> +NIC-RX Sampling rule, the matched ingress packets are duplicated and
>>> +sent to the queue 1, and each second packets are marked with 0x1234
>>> +and sent to queue 0.
>>> +
>>
>> Also each second packets duplicated to queue 1, isn't it, because of 'ratio 2'?
>>
> 
> Yes, 'ratio=2' means that 50% packet will be sampled.
> 

I thought 'sample' action also applies to the "queue index 1" but most probably 
it only applies to 'sample_actions', so original paragraph is correct, perhaps 
except the 'duplicated' detail, and my comment "each second packets duplicated 
to queue 1" is wrong.

Can you please confirm if below is correct:
Assume 10 packets are received, from 1 to 10, after below rule queue status will be:
Queue0: 2, 4, 6, 8, 10 [All marked with 0x1234, duplicated packets]
Queue1: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 [Original packets]


>>> +::
>>> +
>>> + testpmd> set sample_actions 0 mark id  0x1234 / queue index 0 / end
>>> + testpmd> flow create 0 ingress group 1 pattern eth / end actions
>>> +        sample ratio 2 index 0 / queue index 1 / end
>>> +
>>> +E-Switch Sampling rule, the matched ingress packets are duplicated
>>> +and sent to port id 2, and each second packets are sent to eswitch
>> manager.
>>> +
>>
>> what is 'E-Switch', or "eswitch manager", isn't the mirror rule generic?
> 
> Here E-Switch means 'transfer=1' in flow attribute,  I will remove it since the concept is for Mellanox HW.
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH] doc: add sampling and mirroring in testpmd guide
  2021-03-31  9:44     ` Ferruh Yigit
@ 2021-03-31 14:38       ` Jiawei(Jonny) Wang
  2021-03-31 15:26         ` Ferruh Yigit
  0 siblings, 1 reply; 11+ messages in thread
From: Jiawei(Jonny) Wang @ 2021-03-31 14:38 UTC (permalink / raw)
  To: Ferruh Yigit, Slava Ovsiienko, xiaoyun.li, Ori Kam
  Cc: dev, Andrew Rybchenko, NBU-Contact-Thomas Monjalon

Hi Ferruh,

> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Wednesday, March 31, 2021 5:45 PM
> To: Jiawei(Jonny) Wang <jiaweiw@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; xiaoyun.li@intel.com; Ori Kam
> <orika@nvidia.com>
> Cc: dev@dpdk.org; Andrew Rybchenko <arybchenko@solarflare.com>; NBU-
> Contact-Thomas Monjalon <thomas@monjalon.net>
> Subject: Re: [PATCH] doc: add sampling and mirroring in testpmd guide
> 
> On 3/31/2021 7:38 AM, Jiawei(Jonny) Wang wrote:
> > Hi Ferruh,
> >
> >> -----Original Message-----
> >> From: Ferruh Yigit <ferruh.yigit@intel.com>
> >> Sent: Friday, March 26, 2021 1:11 AM
> >> To: Jiawei(Jonny) Wang <jiaweiw@nvidia.com>; Slava Ovsiienko
> >> <viacheslavo@nvidia.com>; xiaoyun.li@intel.com; Ori Kam
> >> <orika@nvidia.com>
> >> Cc: dev@dpdk.org; Andrew Rybchenko <arybchenko@solarflare.com>;
> NBU-
> >> Contact-Thomas Monjalon <thomas@monjalon.net>
> >> Subject: Re: [PATCH] doc: add sampling and mirroring in testpmd guide
> >>
> >> On 3/9/2021 1:18 PM, Jiawei Wang wrote:
> >>> Update documentation for sample action usage in testpmd and show the
> >>> command line example.
> >>>
> >>
> >> +1 to document this.
> >>
> >> Indeed for all testpmd flow update, it must be mandatory to update
> >> "Flow rules management" section for it, Ori what do you think?
> >>
> >>> Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
> >>> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> >>
> >> <...>
> >>
> >>> +Sample Sampling/Mirroring rules
> >>> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >>> +
> >>> +Sample/Mirroring rules can be set by the following commands
> >>> +
> >>> +NIC-RX Sampling rule, the matched ingress packets are duplicated
> >>> +and sent to the queue 1, and each second packets are marked with
> >>> +0x1234 and sent to queue 0.
> >>> +
> >>
> >> Also each second packets duplicated to queue 1, isn't it, because of 'ratio
> 2'?
> >>
> >
> > Yes, 'ratio=2' means that 50% packet will be sampled.
> >
> 
> I thought 'sample' action also applies to the "queue index 1" but most
> probably it only applies to 'sample_actions', so original paragraph is correct,
> perhaps except the 'duplicated' detail, and my comment "each second
> packets duplicated to queue 1" is wrong.
> 

Here sample action is 'Queue index 0" and original action is 'Queue index 1",
sample action only impact on duplicated packets, so 50% duplicated to queue 0.

> Can you please confirm if below is correct:
> Assume 10 packets are received, from 1 to 10, after below rule queue status
> will be:
> Queue0: 2, 4, 6, 8, 10 [All marked with 0x1234, duplicated packets]
> Queue1: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 [Original packets]
> 
> 

My description is not correct here.
The Marked 0x1234 and  5 duplicated packet will be sent to queue 0;
But the duplicated packet order not strict 'each second packet'.
All of the 10 packet will be sent to Queue 1 without mark.

I will update as below:
"
NIC-RX Sampling rule, the matched ingress packets are sent to the queue 1,
and 50% packets are duplicated and marked with 0x1234 and sent to queue 0.
"

> >>> +::
> >>> +
> >>> + testpmd> set sample_actions 0 mark id  0x1234 / queue index 0 /
> >>> + testpmd> end flow create 0 ingress group 1 pattern eth / end
> >>> + testpmd> actions
> >>> +        sample ratio 2 index 0 / queue index 1 / end
> >>> +
> >>> +E-Switch Sampling rule, the matched ingress packets are duplicated
> >>> +and sent to port id 2, and each second packets are sent to eswitch
> >> manager.
> >>> +
> >>
> >> what is 'E-Switch', or "eswitch manager", isn't the mirror rule generic?
> >
> > Here E-Switch means 'transfer=1' in flow attribute,  I will remove it since
> the concept is for Mellanox HW.
> >

Thanks.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH] doc: add sampling and mirroring in testpmd guide
  2021-03-31 14:38       ` Jiawei(Jonny) Wang
@ 2021-03-31 15:26         ` Ferruh Yigit
  0 siblings, 0 replies; 11+ messages in thread
From: Ferruh Yigit @ 2021-03-31 15:26 UTC (permalink / raw)
  To: Jiawei(Jonny) Wang, Slava Ovsiienko, xiaoyun.li, Ori Kam
  Cc: dev, Andrew Rybchenko, NBU-Contact-Thomas Monjalon

On 3/31/2021 3:38 PM, Jiawei(Jonny) Wang wrote:
> Hi Ferruh,
> 
>> -----Original Message-----
>> From: Ferruh Yigit <ferruh.yigit@intel.com>
>> Sent: Wednesday, March 31, 2021 5:45 PM
>> To: Jiawei(Jonny) Wang <jiaweiw@nvidia.com>; Slava Ovsiienko
>> <viacheslavo@nvidia.com>; xiaoyun.li@intel.com; Ori Kam
>> <orika@nvidia.com>
>> Cc: dev@dpdk.org; Andrew Rybchenko <arybchenko@solarflare.com>; NBU-
>> Contact-Thomas Monjalon <thomas@monjalon.net>
>> Subject: Re: [PATCH] doc: add sampling and mirroring in testpmd guide
>>
>> On 3/31/2021 7:38 AM, Jiawei(Jonny) Wang wrote:
>>> Hi Ferruh,
>>>
>>>> -----Original Message-----
>>>> From: Ferruh Yigit <ferruh.yigit@intel.com>
>>>> Sent: Friday, March 26, 2021 1:11 AM
>>>> To: Jiawei(Jonny) Wang <jiaweiw@nvidia.com>; Slava Ovsiienko
>>>> <viacheslavo@nvidia.com>; xiaoyun.li@intel.com; Ori Kam
>>>> <orika@nvidia.com>
>>>> Cc: dev@dpdk.org; Andrew Rybchenko <arybchenko@solarflare.com>;
>> NBU-
>>>> Contact-Thomas Monjalon <thomas@monjalon.net>
>>>> Subject: Re: [PATCH] doc: add sampling and mirroring in testpmd guide
>>>>
>>>> On 3/9/2021 1:18 PM, Jiawei Wang wrote:
>>>>> Update documentation for sample action usage in testpmd and show the
>>>>> command line example.
>>>>>
>>>>
>>>> +1 to document this.
>>>>
>>>> Indeed for all testpmd flow update, it must be mandatory to update
>>>> "Flow rules management" section for it, Ori what do you think?
>>>>
>>>>> Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
>>>>> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
>>>>
>>>> <...>
>>>>
>>>>> +Sample Sampling/Mirroring rules
>>>>> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>> +
>>>>> +Sample/Mirroring rules can be set by the following commands
>>>>> +
>>>>> +NIC-RX Sampling rule, the matched ingress packets are duplicated
>>>>> +and sent to the queue 1, and each second packets are marked with
>>>>> +0x1234 and sent to queue 0.
>>>>> +
>>>>
>>>> Also each second packets duplicated to queue 1, isn't it, because of 'ratio
>> 2'?
>>>>
>>>
>>> Yes, 'ratio=2' means that 50% packet will be sampled.
>>>
>>
>> I thought 'sample' action also applies to the "queue index 1" but most
>> probably it only applies to 'sample_actions', so original paragraph is correct,
>> perhaps except the 'duplicated' detail, and my comment "each second
>> packets duplicated to queue 1" is wrong.
>>
> 
> Here sample action is 'Queue index 0" and original action is 'Queue index 1",
> sample action only impact on duplicated packets, so 50% duplicated to queue 0.
> 
>> Can you please confirm if below is correct:
>> Assume 10 packets are received, from 1 to 10, after below rule queue status
>> will be:
>> Queue0: 2, 4, 6, 8, 10 [All marked with 0x1234, duplicated packets]
>> Queue1: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 [Original packets]
>>
>>
> 
> My description is not correct here.
> The Marked 0x1234 and  5 duplicated packet will be sent to queue 0;
> But the duplicated packet order not strict 'each second packet'.
> All of the 10 packet will be sent to Queue 1 without mark.
> 
> I will update as below:
> "
> NIC-RX Sampling rule, the matched ingress packets are sent to the queue 1,
> and 50% packets are duplicated and marked with 0x1234 and sent to queue 0.
> "
> 

Above looks good, thanks.

>>>>> +::
>>>>> +
>>>>> + testpmd> set sample_actions 0 mark id  0x1234 / queue index 0 /
>>>>> + testpmd> end flow create 0 ingress group 1 pattern eth / end
>>>>> + testpmd> actions
>>>>> +        sample ratio 2 index 0 / queue index 1 / end
>>>>> +
>>>>> +E-Switch Sampling rule, the matched ingress packets are duplicated
>>>>> +and sent to port id 2, and each second packets are sent to eswitch
>>>> manager.
>>>>> +
>>>>
>>>> what is 'E-Switch', or "eswitch manager", isn't the mirror rule generic?
>>>
>>> Here E-Switch means 'transfer=1' in flow attribute,  I will remove it since
>> the concept is for Mellanox HW.
>>>
> 
> Thanks.
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH v3] doc: add sampling and mirroring in testpmd guide
  2021-03-09 13:18 [dpdk-dev] [PATCH] doc: add sampling and mirroring in testpmd guide Jiawei Wang
  2021-03-25 17:10 ` Ferruh Yigit
  2021-03-31  8:51 ` [dpdk-dev] [PATCH v2] " Jiawei Wang
@ 2021-04-01  2:39 ` Jiawei Wang
  2021-04-01 11:52   ` Ferruh Yigit
  2 siblings, 1 reply; 11+ messages in thread
From: Jiawei Wang @ 2021-04-01  2:39 UTC (permalink / raw)
  To: viacheslavo, xiaoyun.li, ferruh.yigit, thomas; +Cc: dev

Update documentation for sample action usage in testpmd and
show the command line example.

Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
v3:
* Update the description for sampling.

v2:
* Update the description.
---
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 52 +++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index f59eb8a..2b407a3 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -2003,6 +2003,24 @@ Set fec mode for a specific port::
 
   testpmd> set port (port_id) fec_mode auto|off|rs|baser
 
+Config Sample actions list
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Configure the sample actions list to be used when sampling a packet by
+rte_flow_action_sample::
+
+ set sample_actions {index} {action} [/ {action} [...]] / end
+
+There are multiple global buffers for ``sample_actions``, this command will set
+one internal buffer index by ``{index}``.
+
+In order to use different sample actions list, ``index`` must be specified
+during the flow rule creation::
+
+ testpmd> flow create 0 ingress pattern eth / ipv4 / end actions
+        sample ratio 2 index 2 / end
+
+Otherwise the default index ``0`` is used.
 
 Port Functions
 --------------
@@ -4841,6 +4859,40 @@ if seid is set)::
  testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 1
         seid is 1 / end actions queue index 3 / end
 
+Sample Sampling/Mirroring rules
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Sample/Mirroring rules can be set by the following commands
+
+NIC-RX Sampling rule, the matched ingress packets and sent to the queue 1,
+and 50% packets are duplicated and marked with 0x1234 and sent to queue 0.
+
+::
+
+ testpmd> set sample_actions 0 mark id  0x1234 / queue index 0 / end
+ testpmd> flow create 0 ingress group 1 pattern eth / end actions
+        sample ratio 2 index 0 / queue index 1 / end
+
+Mirroring rule with port representors (with "transfer" attribute), the matched
+ingress packets with encapsulation header are sent to port id 0, and also
+mirrored the packets and sent to port id 2.
+
+::
+
+ testpmd> set sample_actions 0 port_id id 2 / end
+ testpmd> flow create 1 ingress transfer pattern eth / end actions
+        sample ratio 1 index 0  / raw_encap / port_id id 0 / end
+
+Mirroring rule with port representors (with "transfer" attribute), the matched
+ingress packets are sent to port id 2, and also mirrored the packets with
+encapsulation header and sent to port id 0.
+
+::
+
+ testpmd> set sample_actions 0 raw_encap / port_id id 0 / end
+ testpmd> flow create 0 ingress transfer pattern eth / end actions
+        sample ratio 1 index 0  / port_id id 2 / end
+
 BPF Functions
 --------------
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH v3] doc: add sampling and mirroring in testpmd guide
  2021-04-01  2:39 ` [dpdk-dev] [PATCH v3] " Jiawei Wang
@ 2021-04-01 11:52   ` Ferruh Yigit
  0 siblings, 0 replies; 11+ messages in thread
From: Ferruh Yigit @ 2021-04-01 11:52 UTC (permalink / raw)
  To: Jiawei Wang, viacheslavo, xiaoyun.li, thomas; +Cc: dev, Salem Sol

On 4/1/2021 3:39 AM, Jiawei Wang wrote:
> Update documentation for sample action usage in testpmd and
> show the command line example.
> 
> Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied to dpdk-next-net/main, thanks.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-04-01 11:52 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-09 13:18 [dpdk-dev] [PATCH] doc: add sampling and mirroring in testpmd guide Jiawei Wang
2021-03-25 17:10 ` Ferruh Yigit
2021-03-25 17:15   ` Thomas Monjalon
2021-03-31  6:58     ` Jiawei(Jonny) Wang
2021-03-31  6:38   ` Jiawei(Jonny) Wang
2021-03-31  9:44     ` Ferruh Yigit
2021-03-31 14:38       ` Jiawei(Jonny) Wang
2021-03-31 15:26         ` Ferruh Yigit
2021-03-31  8:51 ` [dpdk-dev] [PATCH v2] " Jiawei Wang
2021-04-01  2:39 ` [dpdk-dev] [PATCH v3] " Jiawei Wang
2021-04-01 11:52   ` Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).