From: Ethan Jackson Date: Fri, 22 Jun 2012 00:57:30 +0000 (-0700) Subject: ofproto-dpif: Place high priority on sending CCMs. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0aa66d6e1b128ea43333fd42086e9e7507ad46a3;p=openvswitch ofproto-dpif: Place high priority on sending CCMs. It's very important to get CCMs out as quickly as possible to avoid causing a fault when there is really no problem. This patch sends CCMs as part of port_run_fast() in an attempt to move in this direction. Signed-off-by: Ethan Jackson --- diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 323d2083..7b86f807 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -541,6 +541,7 @@ ofport_dpif_cast(const struct ofport *ofport) } static void port_run(struct ofport_dpif *); +static void port_run_fast(struct ofport_dpif *); static void port_wait(struct ofport_dpif *); static int set_cfm(struct ofport *, const struct cfm_settings *); static void ofport_clear_priorities(struct ofport_dpif *); @@ -918,8 +919,13 @@ static int run_fast(struct ofproto *ofproto_) { struct ofproto_dpif *ofproto = ofproto_dpif_cast(ofproto_); + struct ofport_dpif *ofport; unsigned int work; + HMAP_FOR_EACH (ofport, up.hmap_node, &ofproto->up.ports) { + port_run_fast(ofport); + } + /* Handle one or more batches of upcalls, until there's nothing left to do * or until we do a fixed total amount of work. * @@ -2424,6 +2430,19 @@ ofproto_port_from_dpif_port(struct ofproto_port *ofproto_port, ofproto_port->ofp_port = odp_port_to_ofp_port(dpif_port->port_no); } +static void +port_run_fast(struct ofport_dpif *ofport) +{ + if (ofport->cfm && cfm_should_send_ccm(ofport->cfm)) { + struct ofpbuf packet; + + ofpbuf_init(&packet, 0); + cfm_compose_ccm(ofport->cfm, &packet, ofport->up.pp.hw_addr); + send_packet(ofport, &packet); + ofpbuf_uninit(&packet); + } +} + static void port_run(struct ofport_dpif *ofport) { @@ -2433,18 +2452,9 @@ port_run(struct ofport_dpif *ofport) ofport->carrier_seq = carrier_seq; + port_run_fast(ofport); if (ofport->cfm) { cfm_run(ofport->cfm); - - if (cfm_should_send_ccm(ofport->cfm)) { - struct ofpbuf packet; - - ofpbuf_init(&packet, 0); - cfm_compose_ccm(ofport->cfm, &packet, ofport->up.pp.hw_addr); - send_packet(ofport, &packet); - ofpbuf_uninit(&packet); - } - enable = enable && !cfm_get_fault(ofport->cfm) && cfm_get_opup(ofport->cfm); }