2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-05 00:35:33 +00:00

odp-util: Add support OVS_ACTION_ATTR_PSAMPLE.

Add support for parsing and formatting the new action.

Also, flag OVS_ACTION_ATTR_SAMPLE as requiring datapath assistance if it
contains a nested OVS_ACTION_ATTR_PSAMPLE. The reason is that the
sampling rate from the parent "sample" is made available to the nested
"psample" by the kernel.

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
Adrian Moreno
2024-07-13 23:23:38 +02:00
committed by Ilya Maximets
parent d9de6b01c2
commit 1a3bd96b4f
10 changed files with 175 additions and 2 deletions

View File

@@ -992,6 +992,31 @@ struct check_pkt_len_arg {
};
#endif
#define OVS_PSAMPLE_COOKIE_MAX_SIZE 16
/**
* enum ovs_pample_attr - Attributes for %OVS_ACTION_ATTR_PSAMPLE
* action.
*
* @OVS_PSAMPLE_ATTR_GROUP: 32-bit number to identify the source of the
* sample.
* @OVS_PSAMPLE_ATTR_COOKIE: An optional variable-length binary cookie that
* contains user-defined metadata. The maximum length is
* OVS_PSAMPLE_COOKIE_MAX_SIZE bytes.
*
* Sends the packet to the psample multicast group with the specified group and
* cookie. It is possible to combine this action with the
* %OVS_ACTION_ATTR_TRUNC action to limit the size of the sample.
*/
enum ovs_psample_attr {
OVS_PSAMPLE_ATTR_GROUP = 1, /* u32 number. */
OVS_PSAMPLE_ATTR_COOKIE, /* Optional, user specified cookie. */
/* private: */
__OVS_PSAMPLE_ATTR_MAX
};
#define OVS_PSAMPLE_ATTR_MAX (__OVS_PSAMPLE_ATTR_MAX - 1)
/**
* enum ovs_action_attr - Action types.
*
@@ -1056,6 +1081,8 @@ struct check_pkt_len_arg {
* of l3 tunnel flag in the tun_flags field of OVS_ACTION_ATTR_ADD_MPLS
* argument.
* @OVS_ACTION_ATTR_DROP: Explicit drop action.
* @OVS_ACTION_ATTR_PSAMPLE: Send a sample of the packet to external observers
* via psample.
*/
enum ovs_action_attr {
@@ -1087,6 +1114,7 @@ enum ovs_action_attr {
OVS_ACTION_ATTR_ADD_MPLS, /* struct ovs_action_add_mpls. */
OVS_ACTION_ATTR_DEC_TTL, /* Nested OVS_DEC_TTL_ATTR_*. */
OVS_ACTION_ATTR_DROP, /* u32 xlate_error. */
OVS_ACTION_ATTR_PSAMPLE, /* Nested OVS_PSAMPLE_ATTR_*. */
#ifndef __KERNEL__
OVS_ACTION_ATTR_TUNNEL_PUSH, /* struct ovs_action_push_tnl*/