On 12/14/2023 2:18 PM, Ferruh Yigit wrote: 
> 
> On 12/14/2023 10:58 AM, Michael Baum wrote:
> > Add support for a new item type "RTE_FLOW_ITEM_TYPE_RANDOM".
> > This item enables to match on some random value as a part of flow rule.
> >

...

> >
> > +Item: ``RANDOM``
> > +^^^^^^^^^^^^^^^^
> > +
> > +Matches a random value.
> > +
> > +A random unsigned integer (at most 32-bit) is generated for each
> > +packet during flow rule processing, by either HW, SW or some external 
> > source.
> > +Application can match on either exact value or range of values.
> > +This value is not based on the packet data/headers.
> > +Application shouldn't assume that this value is kept during the
> > +lifetime of the packet.
> > +
> > +- ``value``: Specific value to match.
> > +
> 
> 
> Hi Michael,
> 
> What is the usecase for the 'random' flow item?
I can think about 2 different use cases:
1. Sampling - when application wants to sample certain percentage of the flow, 
it can match random value for getting it.
2. Distribution - when application wants to distribute the traffic between 
ports/queues, it can match all random value range with send to port/queue 
actions.

> 
> Is it to match some kind of metadata generated by HW?
It can be generated by either HW, SW or some external source.
Each PMD supporting random item responds to have a generator for that.

> Or is it a way to sampling traffic?
It can be both. The PMD can use random value generated by HW while user match 
on it for sampling traffic.

> 
> And how random 'random' item is, is it configured/set in HW or random per 
> packet?
From API perspective, it is pure random not packet oriented. Same packet can 
get different values during the pipeline.
I mentioned it in documentation:
"This value is not based on the packet data/headers.
Application shouldn't assume that this value is kept during the lifetime of the 
packet."

Reply via email to