ofproto-dpif: Place high priority on sending CCMs.
authorEthan Jackson <ethan@nicira.com>
Fri, 22 Jun 2012 00:57:30 +0000 (17:57 -0700)
committerEthan Jackson <ethan@nicira.com>
Fri, 22 Jun 2012 22:12:39 +0000 (15:12 -0700)
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 <ethan@nicira.com>
ofproto/ofproto-dpif.c

index 323d2083b5cf7987fe2c34067a1a2d88a61587ac..7b86f8079ce3da6df1c5b176552492630b5331b9 100644 (file)
@@ -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);
     }