Skip to content

Commit

Permalink
ofp-util: Refactor encoding of OpenFlow 1.1 group desc reply messages.
Browse files Browse the repository at this point in the history
This refactoring is in preparation for supporting encoding
of (draft) OpenFlow 1.5 group mod messages.

ONF-JIRA: EXT-350
Signed-off-by: Simon Horman <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
shorman-netronome authored and blp committed Nov 10, 2014
1 parent aead63f commit 5be5025
Showing 1 changed file with 31 additions and 8 deletions.
39 changes: 31 additions & 8 deletions lib/ofp-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -7231,16 +7231,13 @@ ofputil_put_ofp11_bucket(const struct ofputil_bucket *bucket,
ob->watch_group = htonl(bucket->watch_group);
}

/* Appends a group stats reply that contains the data in 'gds' to those already
* present in the list of ofpbufs in 'replies'. 'replies' should have been
* initialized with ofpmp_init(). */
void
ofputil_append_group_desc_reply(const struct ofputil_group_desc *gds,
struct list *buckets,
struct list *replies)
static void
ofputil_append_ofp11_group_desc_reply(const struct ofputil_group_desc *gds,
struct list *buckets,
struct list *replies,
enum ofp_version version)
{
struct ofpbuf *reply = ofpbuf_from_list(list_back(replies));
enum ofp_version version = ofpmp_version(replies);
struct ofp11_group_desc_stats *ogds;
struct ofputil_bucket *bucket;
size_t start_ogds;
Expand All @@ -7258,6 +7255,32 @@ ofputil_append_group_desc_reply(const struct ofputil_group_desc *gds,
ofpmp_postappend(replies, start_ogds);
}

/* Appends a group stats reply that contains the data in 'gds' to those already
* present in the list of ofpbufs in 'replies'. 'replies' should have been
* initialized with ofpmp_init(). */
void
ofputil_append_group_desc_reply(const struct ofputil_group_desc *gds,
struct list *buckets,
struct list *replies)
{
enum ofp_version version = ofpmp_version(replies);

switch (version)
{
case OFP11_VERSION:
case OFP12_VERSION:
case OFP13_VERSION:
case OFP14_VERSION:
case OFP15_VERSION:
ofputil_append_ofp11_group_desc_reply(gds, buckets, replies, version);
break;

case OFP10_VERSION:
default:
OVS_NOT_REACHED();
}
}

static enum ofperr
ofputil_pull_ofp11_buckets(struct ofpbuf *msg, size_t buckets_length,
enum ofp_version version, struct list *buckets)
Expand Down

0 comments on commit 5be5025

Please sign in to comment.