ofproto meters: Keep provider meter_id over mods.
authorJarno Rajahalme <jrajahalme@nicira.com>
Fri, 13 Sep 2013 22:03:31 +0000 (15:03 -0700)
committerBen Pfaff <blp@nicira.com>
Mon, 16 Sep 2013 22:23:36 +0000 (15:23 -0700)
Changed the ofproto meter API to require the provider keep the provider
meter ID unchanged when modifying a meter.  This makes the mapping from
an OpenFlow meter ID to a datapath meter ID consistent over the lifetime
of the meter.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto/ofproto-provider.h
ofproto/ofproto.c

index bbb9ba1..bc3f966 100644 (file)
@@ -1648,10 +1648,9 @@ struct ofproto_class {
      * implementation.
      *
      * If '*id' is a value other than UINT32_MAX, modifies the existing meter
-     * with that meter provider ID to have configuration 'config'.  On failure,
-     * the existing meter configuration is left intact.  Regardless of success,
-     * any change to '*id' updates the provider meter id used for this
-     * meter. */
+     * with that meter provider ID to have configuration 'config', while
+     * leaving '*id' unchanged.  On failure, the existing meter configuration
+     * is left intact. */
     enum ofperr (*meter_set)(struct ofproto *ofproto, ofproto_meter_id *id,
                              const struct ofputil_meter_config *config);
 
index 9a2a4e8..f97b9bc 100644 (file)
@@ -4928,15 +4928,17 @@ handle_modify_meter(struct ofproto *ofproto, struct ofputil_meter_mod *mm)
 {
     struct meter *meter = ofproto->meters[mm->meter.meter_id];
     enum ofperr error;
+    uint32_t provider_meter_id;
 
     if (!meter) {
         return OFPERR_OFPMMFC_UNKNOWN_METER;
     }
 
+    provider_meter_id = meter->provider_meter_id.uint32;
     error = ofproto->ofproto_class->meter_set(ofproto,
                                               &meter->provider_meter_id,
                                               &mm->meter);
-    ovs_assert(meter->provider_meter_id.uint32 != UINT32_MAX);
+    ovs_assert(meter->provider_meter_id.uint32 == provider_meter_id);
     if (!error) {
         meter_update(meter, &mm->meter);
     }