From e555eb7c38c38b170c165b2e4b9cd222f0fd20e8 Mon Sep 17 00:00:00 2001 From: Jarno Rajahalme Date: Fri, 13 Sep 2013 15:03:31 -0700 Subject: [PATCH] ofproto meters: Keep provider meter_id over mods. 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 Signed-off-by: Ben Pfaff --- ofproto/ofproto-provider.h | 7 +++---- ofproto/ofproto.c | 4 +++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h index bbb9ba115..bc3f96610 100644 --- a/ofproto/ofproto-provider.h +++ b/ofproto/ofproto-provider.h @@ -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); diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 9a2a4e88a..f97b9bc0e 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -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); } -- 2.43.0