[ovs-dev] [LimitFlows 2/4] ofproto: Rename TABLEID_* constants for consistency.

Ben Pfaff blp at nicira.com
Mon Apr 19 21:08:49 UTC 2010


Throughout ofproto the code talks about "exact-match" and "wildcard"
tables.  The TABLEID_* constants talk about "hash" and "classifier" tables
instead, so rename them for consistency.

The changes to the reported ofp_table_stats names are externally visible,
but software should not depend on these names anyhow.
---
 ofproto/ofproto.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 995e6b0..3414b21 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -61,9 +61,10 @@
 
 #include "sflow_api.h"
 
+/* OpenFlow 'table_id's used in, e.g., ofp_flow_stats_request. */
 enum {
-    TABLEID_HASH = 0,
-    TABLEID_CLASSIFIER = 1
+    TABLEID_EXACT = 0,          /* Exact-match table. */
+    TABLEID_WILD = 1            /* Wildcard table. */
 };
 
 struct ofport {
@@ -2490,8 +2491,8 @@ handle_table_stats_request(struct ofproto *p, struct ofconn *ofconn,
     dpif_get_dp_stats(p->dpif, &dpstats);
     ots = append_stats_reply(sizeof *ots, ofconn, &msg);
     memset(ots, 0, sizeof *ots);
-    ots->table_id = TABLEID_HASH;
-    strcpy(ots->name, "hash");
+    ots->table_id = TABLEID_EXACT;
+    strcpy(ots->name, "exact");
     ots->wildcards = htonl(0);
     ots->max_entries = htonl(dpstats.max_capacity);
     ots->active_count = htonl(n_exact);
@@ -2502,8 +2503,8 @@ handle_table_stats_request(struct ofproto *p, struct ofconn *ofconn,
     /* Classifier table. */
     ots = append_stats_reply(sizeof *ots, ofconn, &msg);
     memset(ots, 0, sizeof *ots);
-    ots->table_id = TABLEID_CLASSIFIER;
-    strcpy(ots->name, "classifier");
+    ots->table_id = TABLEID_WILD;
+    strcpy(ots->name, "wildcard");
     ots->wildcards = p->tun_id_from_cookie ? htonl(OVSFW_ALL)
                                            : htonl(OFPFW_ALL);
     ots->max_entries = htonl(65536);
@@ -2661,7 +2662,7 @@ flow_stats_cb(struct cls_rule *rule_, void *cbdata_)
 
     ofs = append_stats_reply(len, cbdata->ofconn, &cbdata->msg);
     ofs->length = htons(len);
-    ofs->table_id = rule->cr.wc.wildcards ? TABLEID_CLASSIFIER : TABLEID_HASH;
+    ofs->table_id = rule->cr.wc.wildcards ? TABLEID_WILD : TABLEID_EXACT;
     ofs->pad = 0;
     flow_to_match(&rule->cr.flow, rule->cr.wc.wildcards,
                   cbdata->ofproto->tun_id_from_cookie, &ofs->match);
@@ -2680,8 +2681,8 @@ flow_stats_cb(struct cls_rule *rule_, void *cbdata_)
 static int
 table_id_to_include(uint8_t table_id)
 {
-    return (table_id == TABLEID_HASH ? CLS_INC_EXACT
-            : table_id == TABLEID_CLASSIFIER ? CLS_INC_WILD
+    return (table_id == TABLEID_EXACT ? CLS_INC_EXACT
+            : table_id == TABLEID_WILD ? CLS_INC_WILD
             : table_id == 0xff ? CLS_INC_ALL
             : 0);
 }
-- 
1.6.6.1





More information about the dev mailing list