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 e468d08..4bec2e7 100644
--- a/ofproto/connmgr.c
+++ b/ofproto/connmgr.c
@@ -2257,7 +2257,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;
@@ -2265,15 +2267,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);
}
}
@@ -2282,7 +2281,6 @@ ofmonitor_resume(struct ofconn *ofconn)
OVS_REQUIRES(ofproto_mutex)
{
struct rule_collection rules;
- struct ofpbuf *resumed;
struct ofmonitor *m;
struct list msgs;
@@ -2292,11 +2290,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 5abeb99..88719a1 100644
--- a/ofproto/connmgr.h
+++ b/ofproto/connmgr.h
@@ -240,4 +240,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 eb97681..99e9bed 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -4826,6 +4826,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