Re: [PATCH net-next v2 9/9] selftests: openvswitch: add emit_sample test

From: Adrián Moreno
Date: Mon Jun 10 2024 - 05:21:03 EST


On Wed, Jun 05, 2024 at 08:43:14PM GMT, Simon Horman wrote:
> On Mon, Jun 03, 2024 at 08:56:43PM +0200, Adrian Moreno wrote:
> > Add a test to verify sampling packets via psample works.
> >
> > In order to do that, create a subcommand in ovs-dpctl.py to listen to
> > on the psample multicast group and print samples.
> >
> > In order to also test simultaneous sFlow and psample actions and
> > packet truncation, add missing parsing support for "userspace" and
> > "trunc" actions.
> >
> > Signed-off-by: Adrian Moreno <amorenoz@xxxxxxxxxx>
>
> ...
>
> > @@ -803,6 +819,25 @@ class ovsactions(nla):
> > self["attrs"].append(["OVS_ACTION_ATTR_EMIT_SAMPLE", emitact])
> > parsed = True
> >
> > + elif parse_starts_block(actstr, "userspace(", False):
> > + uact = self.userspace()
> > + actstr = uact.parse(actstr[len("userpsace(") : ])
>
> nit: userspace
>
> Flagged by checkpatch.pl --codespell
>

Thanks. Will fix it.

> > + self["attrs"].append(["OVS_ACTION_ATTR_USERSPACE", uact])
> > + parsed = True
> > +
> > + elif parse_starts_block(actstr, "trunc", False):
> > + parencount += 1
> > + actstr, val = parse_extract_field(
> > + actstr,
> > + "trunc(",
> > + r"([0-9]+)",
> > + int,
> > + False,
> > + None,
> > + )
> > + self["attrs"].append(["OVS_ACTION_ATTR_TRUNC", val])
> > + parsed = True
> > +
> > actstr = actstr[strspn(actstr, ", ") :]
> > while parencount > 0:
> > parencount -= 1
>