[ovs-dev] [tests+nxm-ofctl 24/42] nicira-ext: Name the enum used for flow formats, to clarify code.

Ben Pfaff blp at nicira.com
Tue Nov 23 22:43:56 UTC 2010


---
 include/openflow/nicira-ext.h |    2 +-
 lib/ofp-util.c                |    6 ++++--
 lib/ofp-util.h                |    5 +++--
 ofproto/ofproto.c             |    2 +-
 4 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/include/openflow/nicira-ext.h b/include/openflow/nicira-ext.h
index d87915e..396ebe8 100644
--- a/include/openflow/nicira-ext.h
+++ b/include/openflow/nicira-ext.h
@@ -892,7 +892,7 @@ OFP_ASSERT(sizeof(struct nx_action_note) == 16);
 /* ## Requests and replies. ## */
 /* ## --------------------- ## */
 
-enum {
+enum nx_flow_format {
     NXFF_OPENFLOW10 = 0,         /* Standard OpenFlow 1.0 compatible. */
     NXFF_TUN_ID_FROM_COOKIE = 1, /* OpenFlow 1.0, plus obtain tunnel ID from
                                   * cookie. */
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index d58f7ea..99ef722 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -103,7 +103,8 @@ enum {
  * wildcarded. */
 void
 ofputil_cls_rule_from_match(const struct ofp_match *match,
-                            unsigned int priority, int flow_format,
+                            unsigned int priority,
+                            enum nx_flow_format flow_format,
                             uint64_t cookie, struct cls_rule *rule)
 {
     struct flow_wildcards *wc = &rule->wc;
@@ -205,7 +206,8 @@ ofputil_cls_rule_from_match(const struct ofp_match *match,
  * the latter case only, 'match''s NXFW_TUN_ID bit will be filled in; otherwise
  * it is always set to 0. */
 void
-ofputil_cls_rule_to_match(const struct cls_rule *rule, int flow_format,
+ofputil_cls_rule_to_match(const struct cls_rule *rule,
+                          enum nx_flow_format flow_format,
                           struct ofp_match *match)
 {
     const struct flow_wildcards *wc = &rule->wc;
diff --git a/lib/ofp-util.h b/lib/ofp-util.h
index fdca005..02096b0 100644
--- a/lib/ofp-util.h
+++ b/lib/ofp-util.h
@@ -22,6 +22,7 @@
 #include <stddef.h>
 #include <stdint.h>
 #include "flow.h"
+#include "openflow/nicira-ext.h"
 #include "openvswitch/types.h"
 
 struct cls_rule;
@@ -38,9 +39,9 @@ int ofputil_netmask_to_wcbits(ovs_be32 netmask);
 
 /* Work with OpenFlow 1.0 ofp_match. */
 void ofputil_cls_rule_from_match(const struct ofp_match *,
-                                 unsigned int priority, int flow_format,
+                                 unsigned int priority, enum nx_flow_format,
                                  uint64_t cookie, struct cls_rule *);
-void ofputil_cls_rule_to_match(const struct cls_rule *, int flow_format,
+void ofputil_cls_rule_to_match(const struct cls_rule *, enum nx_flow_format,
                                struct ofp_match *);
 void normalize_match(struct ofp_match *);
 char *ofp_match_to_literal_string(const struct ofp_match *match);
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 997509a..b635ebe 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -230,7 +230,7 @@ struct ofconn {
     struct list node;           /* In struct ofproto's "all_conns" list. */
     struct rconn *rconn;        /* OpenFlow connection. */
     enum ofconn_type type;      /* Type. */
-    int flow_format;            /* One of NXFF_*. */
+    enum nx_flow_format flow_format; /* Currently selected flow format. */
 
     /* OFPT_PACKET_IN related data. */
     struct rconn_packet_counter *packet_in_counter; /* # queued on 'rconn'. */
-- 
1.7.1





More information about the dev mailing list