Re: [ovs-dev] [RFC PATCH v3 13/13] ofp-actions: Load data from fields in sample action.
On 7/8/24 10:12, Adrián Moreno wrote: > On Thu, Jul 04, 2024 at 11:25:34AM GMT, Dumitru Ceara wrote: >> On 7/4/24 09:52, Adrian Moreno wrote: >>> When sample action gets used as a way of sampling traffic with >>> controller-generated metadata (i.e: obs_domain_id and obs_point_id), >>> the controller will have to increase the number of flows to ensure each >>> part of the pipeline contains the right metadata. >>> >>> As an example, if the controller decides to sample stateful traffic, it >>> could store the computed metadata for each connection in the conntrack >>> label. However, for established connections, a flow must be created for >>> each different ct_label value with a sample action that contains a >>> different hardcoded obs_domain and obs_point id. >>> >>> This patch adds a new version of the NXAST_RAW_SAMPLE* action (number 4) >>> that supports specifying the observation point and domain using an >>> OpenFlow field reference, so now the controller can express: >>> >>> sample(... >>> obs_domain_id=NXM_NX_CT_LABEL[0..31], >>> obs_point_id=NXM_NX_CT_LABEL[32..63] >>> ... >>>) >>> >>> Signed-off-by: Adrian Moreno >>> --- >> >> Hi Adrian, >> >> Thanks a lot for working on expanding the sampling support (in the >> kernel too). >> >> I didn't review the patch (or the rest of the series) yet but one thing >> we should definitely add to the non-RFC version is a way for controllers >> to detect that this new action version is supported. >> >> In other occasions we've used the OVSDB.Datapath.Capabilities column to >> report that new actions are supported (e.g., "ct_flush" for the >> extension that allows flushing CT with a generic match). It might make >> sense to add another capability there for this new action version. >> > > Yep. I've sent v1 but it does not contain this since I wanted to do a > quick respin removing the RFC now that the kernel part landed in > net-next. > > I'll include it in v2. I didn't review the set yet, but while it can be argued that support for the ct flush is partially a datapath feature, the new OF action is definitely not, so it should not be exposed via datapath features. Controller can either probe the action by starting and cancelling a bundle and checking for particular error codes, or we should start reporting match/action extensions via OFPTFPT_EXPERIMENTER property of the table features. Best regards, Ilya Maximets. ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Re: [ovs-dev] [RFC PATCH v3 13/13] ofp-actions: Load data from fields in sample action.
On Thu, Jul 04, 2024 at 11:25:34AM GMT, Dumitru Ceara wrote: > On 7/4/24 09:52, Adrian Moreno wrote: > > When sample action gets used as a way of sampling traffic with > > controller-generated metadata (i.e: obs_domain_id and obs_point_id), > > the controller will have to increase the number of flows to ensure each > > part of the pipeline contains the right metadata. > > > > As an example, if the controller decides to sample stateful traffic, it > > could store the computed metadata for each connection in the conntrack > > label. However, for established connections, a flow must be created for > > each different ct_label value with a sample action that contains a > > different hardcoded obs_domain and obs_point id. > > > > This patch adds a new version of the NXAST_RAW_SAMPLE* action (number 4) > > that supports specifying the observation point and domain using an > > OpenFlow field reference, so now the controller can express: > > > > sample(... > > obs_domain_id=NXM_NX_CT_LABEL[0..31], > > obs_point_id=NXM_NX_CT_LABEL[32..63] > > ... > >) > > > > Signed-off-by: Adrian Moreno > > --- > > Hi Adrian, > > Thanks a lot for working on expanding the sampling support (in the > kernel too). > > I didn't review the patch (or the rest of the series) yet but one thing > we should definitely add to the non-RFC version is a way for controllers > to detect that this new action version is supported. > > In other occasions we've used the OVSDB.Datapath.Capabilities column to > report that new actions are supported (e.g., "ct_flush" for the > extension that allows flushing CT with a generic match). It might make > sense to add another capability there for this new action version. > Yep. I've sent v1 but it does not contain this since I wanted to do a quick respin removing the RFC now that the kernel part landed in net-next. I'll include it in v2. Thanks. Adrián ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Re: [ovs-dev] [RFC PATCH v3 13/13] ofp-actions: Load data from fields in sample action.
On 7/4/24 09:52, Adrian Moreno wrote: > When sample action gets used as a way of sampling traffic with > controller-generated metadata (i.e: obs_domain_id and obs_point_id), > the controller will have to increase the number of flows to ensure each > part of the pipeline contains the right metadata. > > As an example, if the controller decides to sample stateful traffic, it > could store the computed metadata for each connection in the conntrack > label. However, for established connections, a flow must be created for > each different ct_label value with a sample action that contains a > different hardcoded obs_domain and obs_point id. > > This patch adds a new version of the NXAST_RAW_SAMPLE* action (number 4) > that supports specifying the observation point and domain using an > OpenFlow field reference, so now the controller can express: > > sample(... > obs_domain_id=NXM_NX_CT_LABEL[0..31], > obs_point_id=NXM_NX_CT_LABEL[32..63] > ... >) > > Signed-off-by: Adrian Moreno > --- Hi Adrian, Thanks a lot for working on expanding the sampling support (in the kernel too). I didn't review the patch (or the rest of the series) yet but one thing we should definitely add to the non-RFC version is a way for controllers to detect that this new action version is supported. In other occasions we've used the OVSDB.Datapath.Capabilities column to report that new actions are supported (e.g., "ct_flush" for the extension that allows flushing CT with a generic match). It might make sense to add another capability there for this new action version. Best regards, Dumitru ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev
[ovs-dev] [RFC PATCH v3 13/13] ofp-actions: Load data from fields in sample action.
When sample action gets used as a way of sampling traffic with controller-generated metadata (i.e: obs_domain_id and obs_point_id), the controller will have to increase the number of flows to ensure each part of the pipeline contains the right metadata. As an example, if the controller decides to sample stateful traffic, it could store the computed metadata for each connection in the conntrack label. However, for established connections, a flow must be created for each different ct_label value with a sample action that contains a different hardcoded obs_domain and obs_point id. This patch adds a new version of the NXAST_RAW_SAMPLE* action (number 4) that supports specifying the observation point and domain using an OpenFlow field reference, so now the controller can express: sample(... obs_domain_id=NXM_NX_CT_LABEL[0..31], obs_point_id=NXM_NX_CT_LABEL[32..63] ... ) Signed-off-by: Adrian Moreno --- include/openvswitch/ofp-actions.h | 8 +- lib/ofp-actions.c | 249 +++--- ofproto/ofproto-dpif-xlate.c | 55 ++- python/ovs/flow/ofp.py| 8 +- python/ovs/flow/ofp_act.py| 4 +- tests/ofp-actions.at | 5 + tests/system-traffic.at | 74 + 7 files changed, 364 insertions(+), 39 deletions(-) diff --git a/include/openvswitch/ofp-actions.h b/include/openvswitch/ofp-actions.h index 7b57e49ad..56dc2c147 100644 --- a/include/openvswitch/ofp-actions.h +++ b/include/openvswitch/ofp-actions.h @@ -1015,14 +1015,16 @@ enum nx_action_sample_direction { /* OFPACT_SAMPLE. * - * Used for NXAST_SAMPLE, NXAST_SAMPLE2, and NXAST_SAMPLE3. */ + * Used for NXAST_SAMPLE, NXAST_SAMPLE2, NXAST_SAMPLE3 and NXAST_SAMPLE4. */ struct ofpact_sample { OFPACT_PADDED_MEMBERS( struct ofpact ofpact; uint16_t probability; /* Always positive. */ uint32_t collector_set_id; -uint32_t obs_domain_id; -uint32_t obs_point_id; +uint32_t obs_domain_imm; +struct mf_subfield obs_domain_src; +uint32_t obs_point_imm; +struct mf_subfield obs_point_src; ofp_port_t sampling_port; enum nx_action_sample_direction direction; ); diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index da7b1dd31..e329a7e3f 100644 --- a/lib/ofp-actions.c +++ b/lib/ofp-actions.c @@ -330,6 +330,8 @@ enum ofp_raw_action_type { NXAST_RAW_SAMPLE2, /* NX1.0+(41): struct nx_action_sample2. */ NXAST_RAW_SAMPLE3, +/* NX1.0+(51): struct nx_action_sample4, ... VLMFF */ +NXAST_RAW_SAMPLE4, /* NX1.0+(34): struct nx_action_conjunction. */ NXAST_RAW_CONJUNCTION, @@ -6188,6 +6190,34 @@ struct nx_action_sample2 { }; OFP_ASSERT(sizeof(struct nx_action_sample2) == 32); +/* Action structure for NXAST_SAMPLE4 + * + * NXAST_SAMPLE4 was added in Open vSwitch 3.4.0. Compared to NXAST_SAMPLE3, + * it adds support for using field specifiers for observation_domain_id and + * observation_point_id. */ +struct nx_action_sample4 { +ovs_be16 type; /* OFPAT_VENDOR. */ +ovs_be16 len; /* Length is 32. */ +ovs_be32 vendor;/* NX_VENDOR_ID. */ +ovs_be16 subtype; /* NXAST_SAMPLE. */ +ovs_be16 probability; /* Fraction of packets to sample. */ +ovs_be32 collector_set_id; /* ID of collector set in OVSDB. */ +ovs_be32 obs_domain_src;/* Source of the observation_domain_id. */ +union { +ovs_be16 obs_domain_ofs_nbits; /* Range to use from source field. */ +ovs_be32 obs_domain_imm;/* Immediate value for domain id. */ +}; +ovs_be32 obs_point_src; /* Source of the observation_point_id */ +union { +ovs_be16 obs_point_ofs_nbits; /* Range to use from source field. */ +ovs_be32 obs_point_imm;/* Immediate value for point id. */ +}; +ovs_be16 sampling_port; /* Sampling port. */ +uint8_t direction; /* Sampling direction. */ +uint8_t zeros[5]; /* Pad to a multiple of 8 bytes */ + }; + OFP_ASSERT(sizeof(struct nx_action_sample4) == 40); + static enum ofperr decode_NXAST_RAW_SAMPLE(const struct nx_action_sample *nas, enum ofp_version ofp_version OVS_UNUSED, @@ -6199,11 +6229,14 @@ decode_NXAST_RAW_SAMPLE(const struct nx_action_sample *nas, sample->ofpact.raw = NXAST_RAW_SAMPLE; sample->probability = ntohs(nas->probability); sample->collector_set_id = ntohl(nas->collector_set_id); -sample->obs_domain_id = ntohl(nas->obs_domain_id); -sample->obs_point_id = ntohl(nas->obs_point_id); +sample->obs_domain_imm = ntohl(nas->obs_domain_id); +sample->obs_domain_src.field = NULL; +sample->obs_point_imm = ntohl(nas->obs_point_id); +sample->obs_point_src.field = NULL; sample->sampling_port = OFPP_NONE; sample->direction = NX_ACTION_SAMPLE_DEFAULT; -