X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=ofproto%2Fconnmgr.c;h=6432ba660ab66a4178f1a80aa1ba1011a3b0891d;hb=a1bf209f5898fc64a495c2cac94dcb113e0c9910;hp=7776c8898798779e911cd2f41cc4d8eba2e96c5d;hpb=72ba2ed371ae593b6fda1d196c31d7dd408a6a1c;p=sliver-openvswitch.git diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c index 7776c8898..6432ba660 100644 --- a/ofproto/connmgr.c +++ b/ofproto/connmgr.c @@ -27,10 +27,10 @@ #include "odp-util.h" #include "ofp-util.h" #include "ofpbuf.h" +#include "ofproto-provider.h" #include "pinsched.h" #include "poll-loop.h" #include "pktbuf.h" -#include "private.h" #include "rconn.h" #include "shash.h" #include "timeval.h" @@ -137,7 +137,6 @@ struct connmgr { /* In-band control. */ struct in_band *in_band; - long long int next_in_band_update; struct sockaddr_in *extra_in_band_remotes; size_t n_extra_remotes; int in_band_queue; @@ -172,7 +171,6 @@ connmgr_create(struct ofproto *ofproto, mgr->fail_mode = OFPROTO_FAIL_SECURE; mgr->in_band = NULL; - mgr->next_in_band_update = LLONG_MAX; mgr->extra_in_band_remotes = NULL; mgr->n_extra_remotes = 0; mgr->in_band_queue = -1; @@ -242,10 +240,10 @@ connmgr_run(struct connmgr *mgr, size_t i; if (handle_openflow && mgr->in_band) { - if (time_msec() >= mgr->next_in_band_update) { - update_in_band_remotes(mgr); + if (!in_band_run(mgr->in_band)) { + in_band_destroy(mgr->in_band); + mgr->in_band = NULL; } - in_band_run(mgr->in_band); } LIST_FOR_EACH_SAFE (ofconn, next_ofconn, node, &mgr->all_conns) { @@ -309,7 +307,6 @@ connmgr_wait(struct connmgr *mgr, bool handling_openflow) ofconn_wait(ofconn, handling_openflow); } if (handling_openflow && mgr->in_band) { - poll_timer_wait_until(mgr->next_in_band_update); in_band_wait(mgr->in_band); } if (handling_openflow && mgr->fail_open) { @@ -610,14 +607,13 @@ update_in_band_remotes(struct connmgr *mgr) if (!mgr->in_band) { in_band_create(mgr->ofproto, mgr->local_port_name, &mgr->in_band); } - if (mgr->in_band) { - in_band_set_remotes(mgr->in_band, addrs, n_addrs); - } in_band_set_queue(mgr->in_band, mgr->in_band_queue); - mgr->next_in_band_update = time_msec() + 1000; } else { - in_band_destroy(mgr->in_band); - mgr->in_band = NULL; + /* in_band_run() needs a chance to delete any existing in-band flows. + * We will destroy mgr->in_band after it's done with that. */ + } + if (mgr->in_band) { + in_band_set_remotes(mgr->in_band, addrs, n_addrs); } /* Clean up. */ @@ -832,8 +828,30 @@ void ofconn_send_error(const struct ofconn *ofconn, const struct ofp_header *request, int error) { - struct ofpbuf *msg = ofputil_encode_error_msg(error, request); + struct ofpbuf *msg; + + msg = ofputil_encode_error_msg(error, request); if (msg) { + static struct vlog_rate_limit err_rl = VLOG_RATE_LIMIT_INIT(10, 10); + + if (!VLOG_DROP_INFO(&err_rl)) { + const struct ofputil_msg_type *type; + const char *type_name; + size_t request_len; + char *error_s; + + request_len = ntohs(request->length); + type_name = (!ofputil_decode_msg_type_partial(request, + MIN(64, request_len), + &type) + ? ofputil_msg_type_name(type) + : "invalid"); + + error_s = ofputil_error_to_string(error); + VLOG_INFO("%s: sending %s error reply to %s message", + rconn_get_name(ofconn->rconn), error_s, type_name); + free(error_s); + } ofconn_send_reply(ofconn, msg); } } @@ -853,13 +871,6 @@ ofconn_has_pending_opgroups(const struct ofconn *ofconn) return !list_is_empty(&ofconn->opgroups); } -/* Returns the number of pending opgroups on 'ofconn'. */ -size_t -ofconn_n_pending_opgroups(const struct ofconn *ofconn) -{ - return list_size(&ofconn->opgroups); -} - /* Adds 'ofconn_node' to 'ofconn''s list of pending opgroups. * * If 'ofconn' is destroyed or its connection drops, then 'ofconn' will remove