If the reset_counts flag is set on a flow modification message, the
flow counters must be cleared, even if the flow does not already have
the reset_counts flag set. And the flow modification message is not
able to set the reset_counts flag in the flow, so the flag must be
tracked separately and not saved in the flow state.
---
include/openvswitch/ofp-util.h | 2 ++
ofproto/ofproto.c | 5 ++++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/include/openvswitch/ofp-util.h b/include/openvswitch/ofp-util.h
index 8703d2a..b7a32dc 100644
--- a/include/openvswitch/ofp-util.h
+++ b/include/openvswitch/ofp-util.h
@@ -277,6 +277,8 @@ enum ofputil_flow_mod_flags {
set or modified. */
OFPUTIL_FF_NO_READONLY = 1 << 7, /* Allow rules within read only tables
to be modified */
+ OFPUTIL_FF_MOD_RESET_COU = 1 << 8, /* Reset counters for a flow
modification
+ or delete message */
};
/* Protocol-independent flow_mod.
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 53b7226..5af1828 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -5094,6 +5094,9 @@ replace_rule_start(struct ofproto *ofproto, struct
ofproto_flow_mod *ofm,
new_rule->idle_timeout = old_rule->idle_timeout;
new_rule->hard_timeout = old_rule->hard_timeout;
*CONST_CAST(uint16_t *, &new_rule->importance) =
old_rule->importance;
+ if (new_rule->flags & OFPUTIL_FF_RESET_COUNTS) {
+ old_rule->flags |= OFPUTIL_FF_MOD_RESET_COU;
+ }
new_rule->flags = old_rule->flags;
new_rule->created = old_rule->created;
}
@@ -5160,7 +5163,7 @@ replace_rule_finish(struct ofproto *ofproto, struct
ofproto_flow_mod *ofm,
struct ovs_list *dead_cookies)
OVS_REQUIRES(ofproto_mutex)
{
- bool forward_counts = !(new_rule->flags & OFPUTIL_FF_RESET_COUNTS);
+ bool forward_counts = !(new_rule->flags & (OFPUTIL_FF_RESET_COUNTS |
OFPUTIL_FF_MOD_RESET_COU));
struct rule *replaced_rule;
replaced_rule = (old_rule && old_rule->removed_reason != OFPRR_EVICTION)
--
2.10.2
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev