This is in preparation for supporting OpenFlow1.4 flow monitor replies.
Signed-off-by: Simon Horman <[email protected]>
---
v2
* No change
---
ofproto/connmgr.c | 16 +++++-----------
ofproto/connmgr.h | 5 +++++
ofproto/ofproto.c | 25 +++++++++++++++++++++++++
3 files changed, 35 insertions(+), 11 deletions(-)
diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c
index a173456..d525227 100644
--- a/ofproto/connmgr.c
+++ b/ofproto/connmgr.c
@@ -2191,7 +2191,9 @@ ofmonitor_flush(struct connmgr *mgr)
LIST_FOR_EACH (ofconn, node, &mgr->all_conns) {
struct ofpbuf *msg, *next;
+ struct list msgs;
+ list_init(&msgs);
LIST_FOR_EACH_SAFE (msg, next, list_node, &ofconn->updates) {
unsigned int n_bytes;
@@ -2199,15 +2201,12 @@ ofmonitor_flush(struct connmgr *mgr)
ofconn_send(ofconn, msg, ofconn->monitor_counter);
n_bytes = rconn_packet_counter_n_bytes(ofconn->monitor_counter);
if (!ofconn->monitor_paused && n_bytes > 128 * 1024) {
- struct ofpbuf *pause;
-
COVERAGE_INC(ofmonitor_pause);
ofconn->monitor_paused = monitor_seqno++;
- pause = ofpraw_alloc_xid(OFPRAW_NXT_FLOW_MONITOR_PAUSED,
- OFP10_VERSION, htonl(0), 0);
- ofconn_send(ofconn, pause, ofconn->monitor_counter);
+ ofmonitor_compose_paused(&msgs);
}
}
+ ofconn_send_replies(ofconn, &msgs);
}
}
@@ -2216,7 +2215,6 @@ ofmonitor_resume(struct ofconn *ofconn)
OVS_REQUIRES(ofproto_mutex)
{
struct rule_collection rules;
- struct ofpbuf *resumed;
struct ofmonitor *m;
struct list msgs;
@@ -2226,11 +2224,7 @@ ofmonitor_resume(struct ofconn *ofconn)
}
list_init(&msgs);
- ofmonitor_compose_refresh_updates(&rules, &msgs);
-
- resumed = ofpraw_alloc_xid(OFPRAW_NXT_FLOW_MONITOR_RESUMED, OFP10_VERSION,
- htonl(0), 0);
- list_push_back(&msgs, &resumed->list_node);
+ ofmonitor_compose_resumed(&rules, &msgs);
ofconn_send_replies(ofconn, &msgs);
ofconn->monitor_paused = 0;
diff --git a/ofproto/connmgr.h b/ofproto/connmgr.h
index 07ec9e4..f3b9448 100644
--- a/ofproto/connmgr.h
+++ b/ofproto/connmgr.h
@@ -238,4 +238,9 @@ void ofmonitor_compose_refresh_updates(struct
rule_collection *rules,
struct list *msgs)
OVS_REQUIRES(ofproto_mutex);
+void ofmonitor_compose_paused(struct list *msgs);
+void ofmonitor_compose_resumed(struct rule_collection *rules,
+ struct list *msgs)
+ OVS_REQUIRES(ofproto_mutex);
+
#endif /* connmgr.h */
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 8de552f..cfef4ad 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -4752,6 +4752,31 @@ ofmonitor_compose_refresh_updates(struct rule_collection
*rules,
}
static void
+ofproto_compose_paused_or_resumed(struct list *msgs, bool paused)
+{
+ struct ofpbuf *msg;
+ enum ofpraw raw;
+ raw = paused ? OFPRAW_NXT_FLOW_MONITOR_PAUSED
+ : OFPRAW_NXT_FLOW_MONITOR_RESUMED;
+ msg = ofpraw_alloc_xid(raw, OFP10_VERSION, htonl(0), 0);
+ list_push_back(msgs, &msg->list_node);
+}
+
+void
+ofmonitor_compose_paused(struct list *msgs)
+{
+ ofproto_compose_paused_or_resumed(msgs, true);
+}
+
+void
+ofmonitor_compose_resumed(struct rule_collection *rules, struct list *msgs)
+ OVS_REQUIRES(ofproto_mutex)
+{
+ ofmonitor_compose_refresh_updates(rules, msgs);
+ ofproto_compose_paused_or_resumed(msgs, false);
+}
+
+static void
ofproto_collect_ofmonitor_refresh_rule(const struct ofmonitor *m,
struct rule *rule, uint64_t seqno,
struct rule_collection *rules)
--
2.0.0.rc2
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev