[ovs-dev] [connmgr2 1/2] ofp-util: Remove flow_stats_iterator, flows_stats_first(), flow_stats_next()

Ethan Jackson ethan at nicira.com
Wed Mar 30 18:24:15 UTC 2011


Looks Good

On Tue, Mar 29, 2011 at 12:31 PM, Ben Pfaff <blp at nicira.com> wrote:
> Nothing uses these anymore.  ofputil_decode_flow_stats_reply() is a better
> alternative.
> ---
>  lib/ofp-util.c |   45 ---------------------------------------------
>  lib/ofp-util.h |    7 -------
>  2 files changed, 0 insertions(+), 52 deletions(-)
>
> diff --git a/lib/ofp-util.c b/lib/ofp-util.c
> index d91fbb1..cc448bc 100644
> --- a/lib/ofp-util.c
> +++ b/lib/ofp-util.c
> @@ -1876,51 +1876,6 @@ hton_ofp_phy_port(struct ofp_phy_port *opp)
>     opp->peer = htonl(opp->peer);
>  }
>
> -const struct ofp_flow_stats *
> -flow_stats_first(struct flow_stats_iterator *iter,
> -                 const struct ofp_stats_reply *osr)
> -{
> -    iter->pos = osr->body;
> -    iter->end = osr->body + (ntohs(osr->header.length)
> -                             - offsetof(struct ofp_stats_reply, body));
> -    return flow_stats_next(iter);
> -}
> -
> -const struct ofp_flow_stats *
> -flow_stats_next(struct flow_stats_iterator *iter)
> -{
> -    ptrdiff_t bytes_left = iter->end - iter->pos;
> -    const struct ofp_flow_stats *fs;
> -    size_t length;
> -
> -    if (bytes_left < sizeof *fs) {
> -        if (bytes_left != 0) {
> -            VLOG_WARN_RL(&bad_ofmsg_rl,
> -                         "%td leftover bytes in flow stats reply", bytes_left);
> -        }
> -        return NULL;
> -    }
> -
> -    fs = (const void *) iter->pos;
> -    length = ntohs(fs->length);
> -    if (length < sizeof *fs) {
> -        VLOG_WARN_RL(&bad_ofmsg_rl, "flow stats length %zu is shorter than "
> -                     "min %zu", length, sizeof *fs);
> -        return NULL;
> -    } else if (length > bytes_left) {
> -        VLOG_WARN_RL(&bad_ofmsg_rl, "flow stats length %zu but only %td "
> -                     "bytes left", length, bytes_left);
> -        return NULL;
> -    } else if ((length - sizeof *fs) % sizeof fs->actions[0]) {
> -        VLOG_WARN_RL(&bad_ofmsg_rl, "flow stats length %zu has %zu bytes "
> -                     "left over in final action", length,
> -                     (length - sizeof *fs) % sizeof fs->actions[0]);
> -        return NULL;
> -    }
> -    iter->pos += length;
> -    return fs;
> -}
> -
>  static int
>  check_action_exact_len(const union ofp_action *a, unsigned int len,
>                        unsigned int required_len)
> diff --git a/lib/ofp-util.h b/lib/ofp-util.h
> index 75e76e2..fdeb9d9 100644
> --- a/lib/ofp-util.h
> +++ b/lib/ofp-util.h
> @@ -258,13 +258,6 @@ 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;
> -};
> -const struct ofp_flow_stats *flow_stats_first(struct flow_stats_iterator *,
> -                                              const struct ofp_stats_reply *);
> -const struct ofp_flow_stats *flow_stats_next(struct flow_stats_iterator *);
>
>  /* Actions. */
>
> --
> 1.7.1
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>



More information about the dev mailing list