net: openvswitch: add psample action
Add support for a new action: psample. This action accepts a u32 group id and a variable-length cookie and uses the psample multicast group to make the packet available for observability. The maximum length of the user-defined cookie is set to 16, same as tc_cookie, to discourage using cookies that will not be offloadable. Reviewed-by: Michal Kubiak <michal.kubiak@intel.com> Reviewed-by: Aaron Conole <aconole@redhat.com> Reviewed-by: Ilya Maximets <i.maximets@ovn.org> Acked-by: Eelco Chaudron <echaudro@redhat.com> Signed-off-by: Adrian Moreno <amorenoz@redhat.com> Link: https://patch.msgid.link/20240704085710.353845-6-amorenoz@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
7b1b2b60c6
commit
aae0b82b46
@@ -914,6 +914,31 @@ struct check_pkt_len_arg {
|
||||
};
|
||||
#endif
|
||||
|
||||
#define OVS_PSAMPLE_COOKIE_MAX_SIZE 16
|
||||
/**
|
||||
* enum ovs_psample_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.
|
||||
*
|
||||
@@ -966,6 +991,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.
|
||||
*
|
||||
* Only a single header can be set with a single %OVS_ACTION_ATTR_SET. Not all
|
||||
* fields within a header are modifiable, e.g. the IPv4 protocol and fragment
|
||||
@@ -1004,6 +1031,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 error code. */
|
||||
OVS_ACTION_ATTR_PSAMPLE, /* Nested OVS_PSAMPLE_ATTR_*. */
|
||||
|
||||
__OVS_ACTION_ATTR_MAX, /* Nothing past this will be accepted
|
||||
* from userspace. */
|
||||
|
||||
Reference in New Issue
Block a user