[PATCH v2 0/2] ethdev: add random item support

Michael Baum michaelba at nvidia.com
Tue Sep 12 10:40:57 CEST 2023


On Mon, 11 Sep 2023 18:55:45 +0200
Morten Brørup <mb at smartsharesystems.com> wrote: 
> 
> > From: Michael Baum [mailto:michaelba at nvidia.com]
> > Sent: Monday, 11 September 2023 08.42
> >
> > Add support for matching random value using new "rte_flow_item_random"
> > structure.
> 
> I get it. It can be used for things like stochastic sampling.
> 
> However, it doesn't provide support for e.g. 1/100 or 1/500.

It supports those values using "last" field in addition to "spec" and "mask".
It matches a range of random values for any requested percentage.

> 
> So here's a suggestion:
> 
> Instead of "value" (which is irrelevant) & "mask" (which is what really controls the
> probability), wouldn't it be better if "value" was an inverse probability (and
> "mask" was irrelevant)? E.g. value=500 means that there is a 1 of 500 probability
> of a match.
> 
> Would this kind of random item better serve the purpose?
> 
> Or is the random item, in its current form, also required for other purposes?

The random item is more generic than stochastic sampling, it can implement distribution. 
When application wants to distribute the traffic between ports/queues, it can match all random value range with send to port/queue actions.


More information about the dev mailing list