[ovs-dev] [PATCH 2/2] ofproto: Keep track of last used with resubmits
Ethan Jackson
ethan at nicira.com
Tue Oct 12 15:34:06 PDT 2010
This patch uses the resubmit tree to update the last used field of
flows when other flows resubmit into them.
---
ofproto/ofproto.c | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 401a11a..8c5f1fc 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -3662,13 +3662,20 @@ static void
update_time(struct ofproto *ofproto, struct rule *rule,
const struct odp_flow_stats *stats)
{
+ struct rule * cur;
long long int used = msec_from_nsec(stats->used_sec, stats->used_nsec);
- if (used > rule->used) {
- rule->used = used;
- if (rule->super && used > rule->super->used) {
- rule->super->used = used;
+
+ cur = rule;
+ while (cur) {
+ if (used > cur->used) {
+ cur->used = used;
+ if (cur->super && used > cur->super->used) {
+ cur->super->used = used;
+ }
+ netflow_flow_update_time(ofproto->netflow, &cur->nf_flow, used);
}
- netflow_flow_update_time(ofproto->netflow, &rule->nf_flow, used);
+
+ cur = cur->rs_parent;
}
}
--
1.7.3.1
More information about the dev
mailing list