2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-29 15:28:56 +00:00

dpif: Don't pass in '*meter_id' to meter_set commands.

The original intent of the API appears to be that the underlying DPIF
implementaion would choose a local meter id.  However, neither of the
existing datapath meter implementations (userspace or Linux) implemented
that; they expected a valid meter id to be passed in, otherwise they
returned an error.  This commit follows the existing implementations and
makes the API somewhat cleaner.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
Justin Pettit
2018-08-07 19:51:26 -07:00
parent 16770c6d91
commit 8101f03fcd
6 changed files with 22 additions and 22 deletions

View File

@@ -1886,13 +1886,12 @@ dpif_meter_get_features(const struct dpif *dpif,
}
}
/* Adds or modifies meter identified by 'meter_id' in 'dpif'. If '*meter_id'
* is UINT32_MAX, adds a new meter, otherwise modifies an existing meter.
/* Adds or modifies the meter in 'dpif' with the given 'meter_id' and
* the configuration in 'config'.
*
* If meter is successfully added, sets '*meter_id' to the new meter's
* meter number. */
* The meter id specified through 'config->meter_id' is ignored. */
int
dpif_meter_set(struct dpif *dpif, ofproto_meter_id *meter_id,
dpif_meter_set(struct dpif *dpif, ofproto_meter_id meter_id,
struct ofputil_meter_config *config)
{
COVERAGE_INC(dpif_meter_set);
@@ -1918,11 +1917,10 @@ dpif_meter_set(struct dpif *dpif, ofproto_meter_id *meter_id,
int error = dpif->dpif_class->meter_set(dpif, meter_id, config);
if (!error) {
VLOG_DBG_RL(&dpmsg_rl, "%s: DPIF meter %"PRIu32" set",
dpif_name(dpif), meter_id->uint32);
dpif_name(dpif), meter_id.uint32);
} else {
VLOG_WARN_RL(&error_rl, "%s: failed to set DPIF meter %"PRIu32": %s",
dpif_name(dpif), meter_id->uint32, ovs_strerror(error));
meter_id->uint32 = UINT32_MAX;
dpif_name(dpif), meter_id.uint32, ovs_strerror(error));
}
return error;
}