[ovs-dev] [PATCH] ofproto-dpif: Set need_revalidate when removing cfm from ofport.

Alex Wang alexw at nicira.com
Sat Mar 28 18:12:12 UTC 2015


>
> I think that the new version will force a reconfiguration for
> set_cfm(ofport, NULL) even if 'ofport' didn't have any CFM configured.
> That seems wrong to me.
>

Thanks, this is a very good point, I think we should do it the same way as
set_bfd(), where we compare the old pointer and the new one, set the
need_revalidate when they are different,

So, how about this~?

diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 31eba92..2c150b2 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -1822,14 +1822,12 @@ static int
 set_cfm(struct ofport *ofport_, const struct cfm_settings *s)
 {
     struct ofport_dpif *ofport = ofport_dpif_cast(ofport_);
+    struct ofproto_dpif *ofproto = ofproto_dpif_cast(ofport->up.ofproto);
+    struct cfm *old = ofport->cfm;
     int error = 0;

     if (s) {
         if (!ofport->cfm) {
-            struct ofproto_dpif *ofproto;
-
-            ofproto = ofproto_dpif_cast(ofport->up.ofproto);
-            ofproto->backer->need_revalidate = REV_RECONFIGURE;
             ofport->cfm = cfm_create(ofport->up.netdev);
         }

@@ -1843,6 +1841,9 @@ set_cfm(struct ofport *ofport_, const struct
cfm_settings *s)
     cfm_unref(ofport->cfm);
     ofport->cfm = NULL;
 out:
+    if (ofport->cfm != old) {
+        ofproto->backer->need_revalidate = REV_RECONFIGURE;
+    }
     ofproto_dpif_monitor_port_update(ofport, ofport->bfd, ofport->cfm,
                                      ofport->up.pp.hw_addr);
     return error;



More information about the dev mailing list