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

From: Simon Horman
Date: Wed Jun 05 2024 - 15:43:26 EST


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

> + 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