summaryrefslogtreecommitdiff
path: root/include/openvswitch/ofp-actions.h
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2016-11-23 23:15:19 -0800
committerBen Pfaff <blp@ovn.org>2016-11-30 08:46:53 -0800
commit4930ea5620375c28bbdd1c85f8f48b9431c73abe (patch)
treed4f07e580ef2ab05d6030f8e7e4ed32d8c6f2aa5 /include/openvswitch/ofp-actions.h
parent65d8810c5521a18399b726f5e62ab35b8b063614 (diff)
downloadopenvswitch-4930ea5620375c28bbdd1c85f8f48b9431c73abe.tar.gz
ofp-actions: Add "ingress" and "egress" options to "sample" action.
Before Open vSwitch 2.5.90, IPFIX reports from Open vSwitch didn't include whether the packet was ingressing or egressing the switch. Starting in OVS 2.5.90, this information was available but only accurate if the action included a port number that indicated a tunnel. Conflating these two does not always make sense (not every packet involves a tunnel!), so this patch makes it possible for the sample action to simply say whether it's for ingress or egress. This is difficult to test, since the "tests" directory of OVS does not have a proper IPFIX listener. This passes those tests, plus a couple that just verify that the actions are properly parsed and formatted. Benli did test it end-to-end in a VMware use case. Requested-by: Benli Ye <daniely@vmware.com> Tested-by: Benli Ye <daniely@vmware.com> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Simon Horman <simon.horman@netronome.com>
Diffstat (limited to 'include/openvswitch/ofp-actions.h')
-rw-r--r--include/openvswitch/ofp-actions.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/include/openvswitch/ofp-actions.h b/include/openvswitch/ofp-actions.h
index 74e9dccf0..29992614e 100644
--- a/include/openvswitch/ofp-actions.h
+++ b/include/openvswitch/ofp-actions.h
@@ -841,9 +841,23 @@ struct ofpact_note {
uint8_t data[];
};
+/* Direction of sampled packets. */
+enum nx_action_sample_direction {
+ /* OVS will attempt to infer the sample's direction based on whether
+ * 'sampling_port' is the packet's output port. This is generally
+ * effective except when sampling happens as part of an output to a patch
+ * port, which doesn't involve a datapath output action. */
+ NX_ACTION_SAMPLE_DEFAULT,
+
+ /* Explicit direction. This is useful for sampling packets coming in from
+ * or going out of a patch port, where the direction cannot be inferred. */
+ NX_ACTION_SAMPLE_INGRESS,
+ NX_ACTION_SAMPLE_EGRESS
+};
+
/* OFPACT_SAMPLE.
*
- * Used for NXAST_SAMPLE and NXAST_SAMPLE2. */
+ * Used for NXAST_SAMPLE, NXAST_SAMPLE2, and NXAST_SAMPLE3. */
struct ofpact_sample {
struct ofpact ofpact;
uint16_t probability; /* Always positive. */
@@ -851,6 +865,7 @@ struct ofpact_sample {
uint32_t obs_domain_id;
uint32_t obs_point_id;
ofp_port_t sampling_port;
+ enum nx_action_sample_direction direction;
};
/* OFPACT_DEC_TTL.