[ovs-dev] [connmgr 08/15] ofproto: Move hton_ofp_phy_port() to ofp-util.

Ethan Jackson ethan at nicira.com
Tue Mar 22 00:34:57 UTC 2011


Looks Good.

On Tue, Mar 15, 2011 at 11:36 AM, Ben Pfaff <blp at nicira.com> wrote:
> This removes some code from ofproto.c that doesn't really seem to
> belong there to begin with.
> ---
>  lib/ofp-util.c    |   13 +++++++++++++
>  lib/ofp-util.h    |    2 ++
>  ofproto/ofproto.c |   13 -------------
>  3 files changed, 15 insertions(+), 13 deletions(-)
>
> diff --git a/lib/ofp-util.c b/lib/ofp-util.c
> index b4b9ffc..72f1655 100644
> --- a/lib/ofp-util.c
> +++ b/lib/ofp-util.c
> @@ -1752,6 +1752,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)
> diff --git a/lib/ofp-util.h b/lib/ofp-util.h
> index f54d809..a8a1509 100644
> --- a/lib/ofp-util.h
> +++ b/lib/ofp-util.h
> @@ -238,6 +238,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;
>  };
> diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
> index 1786694..d9662c6 100644
> --- a/ofproto/ofproto.c
> +++ b/ofproto/ofproto.c
> @@ -103,7 +103,6 @@ struct ofport {
>  };
>
>  static void ofport_free(struct ofport *);
> -static void hton_ofp_phy_port(struct ofp_phy_port *);
>
>  struct action_xlate_ctx {
>  /* action_xlate_ctx_init() initializes these members. */
> @@ -2520,18 +2519,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)
>  {
> --
> 1.7.1
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>



More information about the dev mailing list