[ovs-dev] [PATCH v2 10/19] ofproto: Use enum ofperr for 'error'.

Jarno Rajahalme jrajahalme at nicira.com
Tue Jun 2 01:13:39 UTC 2015


> On May 29, 2015, at 5:54 PM, Ben Pfaff <blp at nicira.com> wrote:
> 
> On Mon, May 18, 2015 at 04:10:19PM -0700, Jarno Rajahalme wrote:
>> Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
> 
> Hmm, ofproto_rule_create() returns ENOMEM instead of an ofperr on error,
> we should fix that.
> 
> I see a few references to OFPROTO_POSTPONE in function comments too, we
> should drop those since we no longer have that feature.
> 
> Acked-by: Ben Pfaff <blp at nicira.com>

Applied to master with this incremental:

  Jarno

diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h
index 9222fe4..2e4d333 100644
--- a/ofproto/ofproto-provider.h
+++ b/ofproto/ofproto-provider.h
@@ -1766,7 +1766,7 @@ extern const struct ofproto_class ofproto_dpif_class;
 int ofproto_class_register(const struct ofproto_class *);
 int ofproto_class_unregister(const struct ofproto_class *);
 
-int ofproto_flow_mod(struct ofproto *, struct ofputil_flow_mod *)
+enum ofperr ofproto_flow_mod(struct ofproto *, struct ofputil_flow_mod *)
     OVS_EXCLUDED(ofproto_mutex);
 void ofproto_add_flow(struct ofproto *, const struct match *, int priority,
                       const struct ofpact *ofpacts, size_t ofpacts_len)
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 6a8239e..26d8b32 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -2050,13 +2050,12 @@ ofproto_add_flow(struct ofproto *ofproto, const struct match *match,
     }
 }
 
-/* Executes the flow modification specified in 'fm'.  Returns 0 on success, an
- * OFPERR_* OpenFlow error code on failure, or OFPROTO_POSTPONE if the
- * operation cannot be initiated now but may be retried later.
+/* Executes the flow modification specified in 'fm'.  Returns 0 on success, or
+ * an OFPERR_* OpenFlow error code on failure.
  *
  * This is a helper function for in-band control and fail-open and the "learn"
  * action. */
-int
+enum ofperr
 ofproto_flow_mod(struct ofproto *ofproto, struct ofputil_flow_mod *fm)
     OVS_EXCLUDED(ofproto_mutex)
 {
@@ -2719,7 +2718,7 @@ ofproto_rule_create(struct ofproto *ofproto, struct ofputil_flow_mod *fm,
     if (!rule) {
         cls_rule_destroy(cr);
         VLOG_WARN_RL(&rl, "%s: failed to allocate a rule.", ofproto->name);
-        return ENOMEM;
+        return OFPERR_OFPFMFC_UNKNOWN;
     }
 
     /* Initialize base state. */
@@ -4335,9 +4334,8 @@ set_conjunctions(struct rule *rule, const struct cls_conjunction *conjs,
  * in which no matching flow already exists in the flow table.
  *
  * Adds the flow specified by 'ofm', which is followed by 'n_actions'
- * ofp_actions, to the ofproto's flow table.  Returns 0 on success, an OpenFlow
- * error code on failure, or OFPROTO_POSTPONE if the operation cannot be
- * initiated now but may be retried later.
+ * ofp_actions, to the ofproto's flow table.  Returns 0 on success, or an
+ * OpenFlow error code on failure.
  *
  * The caller retains ownership of 'fm->ofpacts'.
  *




More information about the dev mailing list