[ovs-dev] [meters 7/9] ofproto: Meter-related comment updates.

Ben Pfaff blp at nicira.com
Thu Jun 27 22:19:42 UTC 2013


---
 ofproto/ofproto-provider.h |   55 +++++++++++++++++++++++++------------------
 ofproto/ofproto.c          |    2 +-
 ofproto/ofproto.h          |    1 -
 3 files changed, 33 insertions(+), 25 deletions(-)

diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h
index 0e08d19..72c8c4b 100644
--- a/ofproto/ofproto-provider.h
+++ b/ofproto/ofproto-provider.h
@@ -1339,34 +1339,43 @@ struct ofproto_class {
                        ofp_port_t realdev_ofp_port, int vid);
 
 /* ## ------------------------ ## */
-/* ## OpenFlow Meter Functions ## */
+/* ## OpenFlow meter functions ## */
 /* ## ------------------------ ## */
 
     /* These functions should be NULL if an implementation does not support
-     * them.  If meter_get_features is non-NULL, then the rest must also
-     * be non-NULL. */
-    void (*meter_get_features)(const struct ofproto *,
-                               struct ofputil_meter_features *);
-    /* Modifies an existing meter, if the 'ofproto_meter_id *' points to
-     * a value other than UINT32_MAX, otherwise adds a new meter.  On success
-     * a provider meter id is stored at 'ofproto_meter_id *'.  All further
-     * references to the meter will be made with the returned provider meter id
-     * rather than the OpenFlow meter id.  The caller does not try to interpret
-     * the provider meter id (other than UINT32_MAX signifying an invalid
-     * provider meter id), giving the implementation the freedom to either use
-     * the OpenFlow meter_id value provided in the meter configuration, or any
-     * other value suitable for the implementation.
-     * If a meter modification fails, the existing meter configuration is left
-     * intact. */
-    enum ofperr (*meter_set)(struct ofproto *, ofproto_meter_id *,
-                             const struct ofputil_meter_config *);
+     * them.  They must be all null or all non-null.. */
+
+    /* Initializes 'features' to describe the metering features supported by
+     * 'ofproto'. */
+    void (*meter_get_features)(const struct ofproto *ofproto,
+                               struct ofputil_meter_features *features);
+
+    /* If '*id' is UINT32_MAX, adds a new meter with the given 'config'.  On
+     * success the function must store a provider meter ID other than
+     * UINT32_MAX in '*id'.  All further references to the meter will be made
+     * with the returned provider meter id rather than the OpenFlow meter id.
+     * The caller does not try to interpret the provider meter id, giving the
+     * implementation the freedom to either use the OpenFlow meter_id value
+     * provided in the meter configuration, or any other value suitable for the
+     * 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. */
+    enum ofperr (*meter_set)(struct ofproto *ofproto, ofproto_meter_id *id,
+                             const struct ofputil_meter_config *config);
+
     /* Gets the meter and meter band packet and byte counts for maximum of
-     * 'stats->n_bands' bands.  The caller fills in the other stats values.
-     * The band stats are copied to memory at 'stats->bands' provided by the
-     * caller.  The number of returned band stats is returned in
-     * 'stats->n_bands'. */
-    enum ofperr (*meter_get)(const struct ofproto *, ofproto_meter_id,
+     * 'stats->n_bands' bands for the meter with provider ID 'id' within
+     * 'ofproto'.  The caller fills in the other stats values.  The band stats
+     * are copied to memory at 'stats->bands' provided by the caller.  The
+     * number of returned band stats is returned in 'stats->n_bands'. */
+    enum ofperr (*meter_get)(const struct ofproto *ofproto,
+                             ofproto_meter_id id,
                              struct ofputil_meter_stats *stats);
+
     /* Deletes a meter, making the 'ofproto_meter_id' invalid for any
      * further calls. */
     void (*meter_del)(struct ofproto *, ofproto_meter_id);
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index f5be583..b09735a 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -4353,7 +4353,7 @@ handle_meter_mod(struct ofconn *ofconn, const struct ofp_header *oh)
         for (meter_id = first; meter_id <= last; ++meter_id) {
             struct meter *meter = ofproto->meters[meter_id];
             if (!meter) {
-                continue; /* Skip non-existing meters. */
+                continue;
             }
 
             if (!list_is_empty(&meter->rules)) {
diff --git a/ofproto/ofproto.h b/ofproto/ofproto.h
index 5c8cb03..792df89 100644
--- a/ofproto/ofproto.h
+++ b/ofproto/ofproto.h
@@ -430,7 +430,6 @@ bool ofproto_has_vlan_usage_changed(const struct ofproto *);
 int ofproto_port_set_realdev(struct ofproto *, ofp_port_t vlandev_ofp_port,
                              ofp_port_t realdev_ofp_port, int vid);
 
-/* Returns UINT32_MAX if the given of_meter_id is invalid. */
 uint32_t ofproto_get_provider_meter_id(const struct ofproto *,
                                        uint32_t of_meter_id);
 
-- 
1.7.2.5




More information about the dev mailing list