#include "byte-order.h"
#include "dynamic-string.h"
+#include "match.h"
#include "meta-flow.h"
#include "nx-match.h"
#include "ofp-actions.h"
learn_check(const struct ofpact_learn *learn, const struct flow *flow)
{
const struct ofpact_learn_spec *spec;
- struct cls_rule rule;
+ struct match match;
- cls_rule_init_catchall(&rule, 0);
+ match_init_catchall(&match);
for (spec = learn->specs; spec < &learn->specs[learn->n_specs]; spec++) {
enum ofperr error;
/* Check the destination. */
switch (spec->dst_type) {
case NX_LEARN_DST_MATCH:
- error = mf_check_src(&spec->dst, &rule.flow);
+ error = mf_check_src(&spec->dst, &match.flow);
if (error) {
return error;
}
- mf_write_subfield(&spec->dst, &spec->src_imm, &rule);
+ mf_write_subfield(&spec->dst, &spec->src_imm, &match);
break;
case NX_LEARN_DST_LOAD:
- error = mf_check_dst(&spec->dst, &rule.flow);
+ error = mf_check_dst(&spec->dst, &match.flow);
if (error) {
return error;
}
{
const struct ofpact_learn_spec *spec;
- cls_rule_init_catchall(&fm->cr, learn->priority);
+ match_init_catchall(&fm->match);
+ fm->priority = learn->priority;
fm->cookie = htonll(0);
fm->cookie_mask = htonll(0);
fm->new_cookie = htonll(learn->cookie);
switch (spec->dst_type) {
case NX_LEARN_DST_MATCH:
- mf_write_subfield(&spec->dst, &value, &fm->cr);
+ mf_write_subfield(&spec->dst, &value, &fm->match);
break;
case NX_LEARN_DST_LOAD:
*
* Prints an error on stderr and aborts the program if 'arg' syntax is invalid.
*
- * If 'flow' is nonnull, then it should be the flow from a cls_rule that is
+ * If 'flow' is nonnull, then it should be the flow from a struct match that is
* the matching rule for the learning action. This helps to better validate
* the action's arguments.
*
char *name, *value;
struct ofpact_learn *learn;
- struct cls_rule rule;
+ struct match match;
enum ofperr error;
learn = ofpact_put_LEARN(ofpacts);
learn->priority = OFP_DEFAULT_PRIORITY;
learn->table_id = 1;
- cls_rule_init_catchall(&rule, 0);
+ match_init_catchall(&match);
while (ofputil_parse_key_value(&arg, &name, &value)) {
if (!strcmp(name, "table")) {
learn->table_id = atoi(value);
}
if ((spec->dst_type == NX_LEARN_DST_MATCH
|| spec->dst_type == NX_LEARN_DST_LOAD)
- && !mf_are_prereqs_ok(spec->dst.field, &rule.flow)) {
+ && !mf_are_prereqs_ok(spec->dst.field, &match.flow)) {
ovs_fatal(0, "%s: cannot specify destination field %s because "
"prerequisites are not satisfied",
orig, spec->dst.field->name);
}
- /* Update 'rule' to allow for satisfying destination
+ /* Update 'match' to allow for satisfying destination
* prerequisites. */
if (spec->src_type == NX_LEARN_SRC_IMMEDIATE
&& spec->dst_type == NX_LEARN_DST_MATCH) {
- mf_write_subfield(&spec->dst, &spec->src_imm, &rule);
+ mf_write_subfield(&spec->dst, &spec->src_imm, &match);
}
}
}
learn_format(const struct ofpact_learn *learn, struct ds *s)
{
const struct ofpact_learn_spec *spec;
- struct cls_rule rule;
+ struct match match;
- cls_rule_init_catchall(&rule, 0);
+ match_init_catchall(&match);
ds_put_format(s, "learn(table=%"PRIu8, learn->table_id);
if (learn->idle_timeout != OFP_FLOW_PERMANENT) {