[ovs-dev] [PATCH] ofproto: Use OFPERR_OFPFMFC_TABLE_FULL for OpenFlow 1.1+

Ben Pfaff blp at nicira.com
Fri Oct 12 17:16:11 UTC 2012


On Fri, Oct 12, 2012 at 10:00:38AM -0700, Ben Pfaff wrote:
> On Fri, Oct 12, 2012 at 09:26:58AM +0900, Simon Horman wrote:
> > Use OFPERR_OFPFMFC_ALL_TABLES_FULL in place of
> > OFPERR_OFPFMFC_TABLE_FULL for OpenFlow 1.1+.
> > 
> > OFPERR_OFPFMFC_ALL_TABLES_FULL only exists in OpenFlow 1.0.
> > OFPERR_OFPFMFC_TABLE_FULL was added in OpenFlow 1.1.
> > 
> > Signed-off-by: Simon Horman <horms at verge.net.au>
> 
> These two codes represent essentially the same condition so I think
> the following would be a better change.  What you think?

I forgot to run the testsuite after making my change.  Here's an
updated commit.

--8<--------------------------cut here-------------------------->8--

From: Ben Pfaff <blp at nicira.com>
Date: Fri, 12 Oct 2012 10:15:11 -0700
Subject: [PATCH] ofp-errors: Merge OF1.0 "all tables full" with OF1.1+ "table full".

These codes represent essentially the same condition and only one of them
exists in any given version of OpenFlow, so merge them together into a
single OFPERR_* code.

Reported-by: Simon Horman <horms at verge.net.au>
Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 include/openflow/nicira-ext.h |    7 +++----
 lib/ofp-errors.h              |    5 +----
 ofproto/ofproto.c             |    4 ++--
 tests/ofproto.at              |    6 +++---
 4 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/include/openflow/nicira-ext.h b/include/openflow/nicira-ext.h
index 7e49550..8e6af52 100644
--- a/include/openflow/nicira-ext.h
+++ b/include/openflow/nicira-ext.h
@@ -129,10 +129,9 @@ enum nx_hash_fields {
  *      table.  If an identical flow already exists in that table only, then it
  *      is replaced.  If the flow cannot be placed in the specified table,
  *      either because the table is full or because the table cannot support
- *      flows of the given type, the switch replies with an
- *      OFPFMFC_ALL_TABLES_FULL error.  (A controller can distinguish these
- *      cases by comparing the current and maximum number of entries reported
- *      in ofp_table_stats.)
+ *      flows of the given type, the switch replies with an OFPFMFC_TABLE_FULL
+ *      error.  (A controller can distinguish these cases by comparing the
+ *      current and maximum number of entries reported in ofp_table_stats.)
  *
  *      If the table ID is wildcarded, the switch picks an appropriate table
  *      itself.  If an identical flow already exist in the selected flow table,
diff --git a/lib/ofp-errors.h b/lib/ofp-errors.h
index a883e20..ffac8aa 100644
--- a/lib/ofp-errors.h
+++ b/lib/ofp-errors.h
@@ -309,10 +309,7 @@ enum ofperr {
     /* OF1.1+(5,0).  Unspecified error. */
     OFPERR_OFPFMFC_UNKNOWN,
 
-    /* OF1.0(3,0).  Flow not added because of full tables. */
-    OFPERR_OFPFMFC_ALL_TABLES_FULL,
-
-    /* OF1.1+(5,1).  Flow not added because table was full. */
+    /* OF1.0(3,0), OF1.1+(5,1).  Flow not added because of full table(s). */
     OFPERR_OFPFMFC_TABLE_FULL,
 
     /* OF1.1+(5,2).  Table does not exist */
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index a128a6d..6cdce93 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -2988,7 +2988,7 @@ add_flow(struct ofproto *ofproto, struct ofconn *ofconn,
             rule->evictable = was_evictable;
 
             if (!evict) {
-                error = OFPERR_OFPFMFC_ALL_TABLES_FULL;
+                error = OFPERR_OFPFMFC_TABLE_FULL;
                 goto exit;
             } else if (evict->pending) {
                 error = OFPROTO_POSTPONE;
@@ -3293,7 +3293,7 @@ handle_flow_mod(struct ofconn *ofconn, const struct ofp_header *oh)
          * is not required in OpenFlow 1.0.1 and removed from OpenFlow 1.1.
          * There is no good error code, so just state that the flow table
          * is full. */
-        error = OFPERR_OFPFMFC_ALL_TABLES_FULL;
+        error = OFPERR_OFPFMFC_TABLE_FULL;
     }
     if (!error) {
         error = ofpacts_check(fm.ofpacts, fm.ofpacts_len,
diff --git a/tests/ofproto.at b/tests/ofproto.at
index 8a728e4..1e5664a 100644
--- a/tests/ofproto.at
+++ b/tests/ofproto.at
@@ -456,12 +456,12 @@ NXST_FLOW reply:
 # Adding another flow will be refused.
 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop], [1], [], [stderr])
 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
-  [OFPT_ERROR: OFPFMFC_ALL_TABLES_FULL
+  [OFPT_ERROR: OFPFMFC_TABLE_FULL
 ])
 # Also a mod-flow that would add a flow will be refused.
 AT_CHECK([ovs-ofctl mod-flows br0 in_port=5,actions=drop], [1], [], [stderr])
 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
-  [OFPT_ERROR: OFPFMFC_ALL_TABLES_FULL
+  [OFPT_ERROR: OFPFMFC_TABLE_FULL
 ])
 # Replacing or modifying an existing flow is allowed.
 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,actions=normal])
@@ -522,7 +522,7 @@ NXST_FLOW reply:
 AT_CHECK([ovs-ofctl add-flow br0 in_port=7,actions=normal])
 AT_CHECK([ovs-ofctl add-flow br0 in_port=8,actions=drop], [1], [], [stderr])
 AT_CHECK([head -n 1 stderr | ofctl_strip], [0],
-  [OFPT_ERROR: OFPFMFC_ALL_TABLES_FULL
+  [OFPT_ERROR: OFPFMFC_TABLE_FULL
 ])
 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
  in_port=4 actions=NORMAL
-- 
1.7.2.5




More information about the dev mailing list