[ovs-dev] [RFC PATCH] ofproto: update flow_stats flags on flow_stats_request
Daniel Baluta
dbaluta at ixiacom.com
Sat Sep 7 23:21:25 UTC 2013
This is a first step in implementing 'on demand flow counters'.
We save flow_mod flags into newly created rule when a new flow
is added, and echo them back in the flow stats request.
Signed-off-by: Daniel Baluta <dbaluta at ixiacom.com>
---
* This just an RFC patch and need more comments and testing
ofproto/ofproto-provider.h | 1 +
ofproto/ofproto.c | 5 ++---
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h
index 0b8a5e5..eabb32b 100644
--- a/ofproto/ofproto-provider.h
+++ b/ofproto/ofproto-provider.h
@@ -227,6 +227,7 @@ struct rule {
rwlock. */
struct hindex_node cookie_node; /* In owning ofproto's 'cookies' index. */
+ enum ofputil_flow_mod_flags flags;
long long int created; /* Creation time. */
long long int modified; /* Time of last modification. */
long long int used; /* Last use; time created if never used. */
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 4d33de7..25a1286 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -3146,11 +3146,9 @@ handle_flow_stats_request(struct ofconn *ofconn,
fs.hard_timeout = rule->hard_timeout;
ovs_mutex_unlock(&rule->timeout_mutex);
- fs.flags = 0;
+ fs.flags = rule->flags;
if (rule->send_flow_removed) {
fs.flags |= OFPUTIL_FF_SEND_FLOW_REM;
- /* FIXME: Implement OFPUTIL_FF_NO_PKT_COUNTS and
- OFPUTIL_FF_NO_BYT_COUNTS. */
}
ofputil_append_flow_stats_reply(&fs, &replies);
}
@@ -3568,6 +3566,7 @@ add_flow(struct ofproto *ofproto, struct ofconn *ofconn,
rule->table_id = table - ofproto->tables;
rule->send_flow_removed = (fm->flags & OFPUTIL_FF_SEND_FLOW_REM) != 0;
+ rule->flags = fm->flags;
rule->ofpacts = xmemdup(fm->ofpacts, fm->ofpacts_len);
rule->ofpacts_len = fm->ofpacts_len;
rule->meter_id = find_meter(rule->ofpacts, rule->ofpacts_len);
--
1.7.10.4
More information about the dev
mailing list