* If a rule is found and 'wc' is non-null, bitwise-OR's 'wc' with the
* set of bits that were significant in the lookup. At some point
* earlier, 'wc' should have been initialized (e.g., by
- * flow_wildcards_init_catchall()). */
+ * flow_wildcards_init_catchall()).
+ *
+ * 'flow' is non-const to allow for temporary modifications during the lookup.
+ * Any changes are restored before returning. */
const struct cls_rule *
-classifier_lookup(const struct classifier *cls, const struct flow *flow,
+classifier_lookup(const struct classifier *cls, struct flow *flow,
struct flow_wildcards *wc)
{
const struct cls_partition *partition;
/* Lookups. These are RCU protected and may run concurrently with modifiers
* and each other. */
const struct cls_rule *classifier_lookup(const struct classifier *,
- const struct flow *,
+ struct flow *,
struct flow_wildcards *);
bool classifier_rule_overlaps(const struct classifier *,
const struct cls_rule *);
tnl_port_unref(cr);
}
+/* 'flow' is non-const to allow for temporary modifications during the lookup.
+ * Any changes are restored before returning. */
odp_port_t
-tnl_port_map_lookup(const struct flow *flow, struct flow_wildcards *wc)
+tnl_port_map_lookup(struct flow *flow, struct flow_wildcards *wc)
{
const struct cls_rule *cr = classifier_lookup(&cls, flow, wc);
#include "packets.h"
#include "util.h"
-odp_port_t tnl_port_map_lookup(const struct flow *flow,
- struct flow_wildcards *wc);
+odp_port_t tnl_port_map_lookup(struct flow *flow, struct flow_wildcards *wc);
void tnl_port_map_insert(odp_port_t port, ovs_be32 ip_dst, ovs_be16 udp_port,
const char dev_name[]);
/* The returned rule (if any) is valid at least until the next RCU quiescent
* period. If the rule needs to stay around longer, a non-zero 'take_ref'
- * must be passed in to cause a reference to be taken on it. */
+ * must be passed in to cause a reference to be taken on it.
+ *
+ * 'flow' is non-const to allow for temporary modifications during the lookup.
+ * Any changes are restored before returning. */
static struct rule_dpif *
rule_dpif_lookup_in_table(struct ofproto_dpif *ofproto, uint8_t table_id,
- const struct flow *flow, struct flow_wildcards *wc,
+ struct flow *flow, struct flow_wildcards *wc,
bool take_ref)
{
struct classifier *cls = &ofproto->up.tables[table_id].cls;
* on it before this returns.
*
* 'in_port' allows the lookup to take place as if the in port had the value
- * 'in_port'. This is needed for resubmit action support. */
+ * 'in_port'. This is needed for resubmit action support.
+ *
+ * 'flow' is non-const to allow for temporary modifications during the lookup.
+ * Any changes are restored before returning. */
struct rule_dpif *
rule_dpif_lookup_from_table(struct ofproto_dpif *ofproto, struct flow *flow,
struct flow_wildcards *wc, bool take_ref,