ofproto: Move hton_ofp_phy_port() to ofp-util.
authorBen Pfaff <blp@nicira.com>
Tue, 15 Mar 2011 17:08:54 +0000 (10:08 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 29 Mar 2011 19:28:10 +0000 (12:28 -0700)
This removes some code from ofproto.c that doesn't really seem to
belong there to begin with.

lib/ofp-util.c
lib/ofp-util.h
ofproto/ofproto.c

index e42abc5..d91fbb1 100644 (file)
@@ -1863,6 +1863,19 @@ make_echo_reply(const struct ofp_header *rq)
     return out;
 }
 
+/* Converts the members of 'opp' from host to network byte order. */
+void
+hton_ofp_phy_port(struct ofp_phy_port *opp)
+{
+    opp->port_no = htons(opp->port_no);
+    opp->config = htonl(opp->config);
+    opp->state = htonl(opp->state);
+    opp->curr = htonl(opp->curr);
+    opp->advertised = htonl(opp->advertised);
+    opp->supported = htonl(opp->supported);
+    opp->peer = htonl(opp->peer);
+}
+
 const struct ofp_flow_stats *
 flow_stats_first(struct flow_stats_iterator *iter,
                  const struct ofp_stats_reply *osr)
index b4fe642..75e76e2 100644 (file)
@@ -257,6 +257,8 @@ struct ofpbuf *make_unbuffered_packet_out(const struct ofpbuf *packet,
 struct ofpbuf *make_echo_request(void);
 struct ofpbuf *make_echo_reply(const struct ofp_header *rq);
 
+void hton_ofp_phy_port(struct ofp_phy_port *);
+
 struct flow_stats_iterator {
     const uint8_t *pos, *end;
 };
index 699985c..bd81a55 100644 (file)
@@ -107,7 +107,6 @@ struct ofport {
 static void ofport_free(struct ofport *);
 static void ofport_run(struct ofproto *, struct ofport *);
 static void ofport_wait(struct ofport *);
-static void hton_ofp_phy_port(struct ofp_phy_port *);
 
 struct action_xlate_ctx {
 /* action_xlate_ctx_init() initializes these members. */
@@ -2633,18 +2632,6 @@ send_error_oh(const struct ofconn *ofconn, const struct ofp_header *oh,
     }
 }
 
-static void
-hton_ofp_phy_port(struct ofp_phy_port *opp)
-{
-    opp->port_no = htons(opp->port_no);
-    opp->config = htonl(opp->config);
-    opp->state = htonl(opp->state);
-    opp->curr = htonl(opp->curr);
-    opp->advertised = htonl(opp->advertised);
-    opp->supported = htonl(opp->supported);
-    opp->peer = htonl(opp->peer);
-}
-
 static int
 handle_echo_request(struct ofconn *ofconn, const struct ofp_header *oh)
 {