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>
* 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);
{
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);
}