mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 14:25:26 +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:
committed by
Ilya Maximets
parent
d9de6b01c2
commit
1a3bd96b4f
@@ -818,13 +818,13 @@ requires_datapath_assistance(const struct nlattr *a)
|
||||
case OVS_ACTION_ATTR_RECIRC:
|
||||
case OVS_ACTION_ATTR_CT:
|
||||
case OVS_ACTION_ATTR_METER:
|
||||
case OVS_ACTION_ATTR_PSAMPLE:
|
||||
return true;
|
||||
|
||||
case OVS_ACTION_ATTR_SET:
|
||||
case OVS_ACTION_ATTR_SET_MASKED:
|
||||
case OVS_ACTION_ATTR_PUSH_VLAN:
|
||||
case OVS_ACTION_ATTR_POP_VLAN:
|
||||
case OVS_ACTION_ATTR_SAMPLE:
|
||||
case OVS_ACTION_ATTR_HASH:
|
||||
case OVS_ACTION_ATTR_PUSH_MPLS:
|
||||
case OVS_ACTION_ATTR_POP_MPLS:
|
||||
@@ -841,6 +841,28 @@ requires_datapath_assistance(const struct nlattr *a)
|
||||
case OVS_ACTION_ATTR_DROP:
|
||||
return false;
|
||||
|
||||
case OVS_ACTION_ATTR_SAMPLE: {
|
||||
/* Nested "psample" actions rely on the datapath executing the
|
||||
* parent "sample", storing the probability and making it available
|
||||
* when the nested "psample" is run. */
|
||||
const struct nlattr *attr;
|
||||
unsigned int left;
|
||||
|
||||
NL_NESTED_FOR_EACH (attr, left, a) {
|
||||
if (nl_attr_type(attr) == OVS_SAMPLE_ATTR_ACTIONS) {
|
||||
const struct nlattr *act;
|
||||
unsigned int act_left;
|
||||
|
||||
NL_NESTED_FOR_EACH (act, act_left, attr) {
|
||||
if (nl_attr_type(act) == OVS_ACTION_ATTR_PSAMPLE) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
case OVS_ACTION_ATTR_UNSPEC:
|
||||
case __OVS_ACTION_ATTR_MAX:
|
||||
OVS_NOT_REACHED();
|
||||
@@ -1229,6 +1251,7 @@ odp_execute_actions(void *dp, struct dp_packet_batch *batch, bool steal,
|
||||
case OVS_ACTION_ATTR_CT:
|
||||
case OVS_ACTION_ATTR_UNSPEC:
|
||||
case OVS_ACTION_ATTR_DEC_TTL:
|
||||
case OVS_ACTION_ATTR_PSAMPLE:
|
||||
case __OVS_ACTION_ATTR_MAX:
|
||||
/* The following actions are handled by the scalar implementation. */
|
||||
case OVS_ACTION_ATTR_POP_VLAN:
|
||||
|
Reference in New Issue
Block a user