}
}
+static const char *
+ofputil_table_vacancy_to_string(enum ofputil_table_vacancy vacancy)
+{
+ switch (vacancy) {
+ case OFPUTIL_TABLE_VACANCY_DEFAULT: return "default";
+ case OFPUTIL_TABLE_VACANCY_ON: return "on";
+ case OFPUTIL_TABLE_VACANCY_OFF: return "off";
+ default: return "***error***";
+ }
+
+}
+
static void
ofp_print_table_mod(struct ds *string, const struct ofp_header *oh)
{
ds_put_cstr(string, "eviction_flags=");
ofputil_put_eviction_flags(string, pm.eviction_flags);
}
+ if (pm.vacancy != OFPUTIL_TABLE_VACANCY_DEFAULT) {
+ ds_put_format(string, ", vacancy=%s",
+ ofputil_table_vacancy_to_string(pm.vacancy));
+ if (pm.vacancy == OFPUTIL_TABLE_VACANCY_ON) {
+ ds_put_format(string, " vacancy:%"PRIu8""
+ ",%"PRIu8"", pm.table_vacancy.vacancy_down,
+ pm.table_vacancy.vacancy_up);
+ }
+ }
}
/* This function will print the Table description properties. */
}
static void
-ofp_print_meter_mod(struct ds *s, const struct ofp_header *oh)
+ofp_print_meter_mod__(struct ds *s, const struct ofputil_meter_mod *mm)
{
- struct ofputil_meter_mod mm;
- struct ofpbuf bands;
- enum ofperr error;
-
- ofpbuf_init(&bands, 64);
- error = ofputil_decode_meter_mod(oh, &mm, &bands);
- if (error) {
- ofpbuf_uninit(&bands);
- ofp_print_error(s, error);
- return;
- }
-
- switch (mm.command) {
+ switch (mm->command) {
case OFPMC13_ADD:
ds_put_cstr(s, " ADD ");
break;
ds_put_cstr(s, " DEL ");
break;
default:
- ds_put_format(s, " cmd:%d ", mm.command);
+ ds_put_format(s, " cmd:%d ", mm->command);
}
- ofp_print_meter_config(s, &mm.meter);
+ ofp_print_meter_config(s, &mm->meter);
+}
+
+static void
+ofp_print_meter_mod(struct ds *s, const struct ofp_header *oh)
+{
+ struct ofputil_meter_mod mm;
+ struct ofpbuf bands;
+ enum ofperr error;
+
+ ofpbuf_init(&bands, 64);
+ error = ofputil_decode_meter_mod(oh, &mm, &bands);
+ if (error) {
+ ofp_print_error(s, error);
+ } else {
+ ofp_print_meter_mod__(s, &mm);
+ }
ofpbuf_uninit(&bands);
}
static void
ofp_print_group(struct ds *s, uint32_t group_id, uint8_t type,
- struct ovs_list *p_buckets, struct ofputil_group_props *props,
+ const struct ovs_list *p_buckets,
+ const struct ofputil_group_props *props,
enum ofp_version ofp_version, bool suppress_type)
{
struct ofputil_bucket *bucket;
}
if (props->selection_method[0]) {
- size_t mark, start;
-
- ds_put_format(s, ",selection_method=%s,", props->selection_method);
+ ds_put_format(s, ",selection_method=%s", props->selection_method);
if (props->selection_method_param) {
- ds_put_format(s, "selection_method_param=%"PRIu64",",
+ ds_put_format(s, ",selection_method_param=%"PRIu64,
props->selection_method_param);
}
- /* Allow rewinding to immediately before the trailing ',' */
- mark = s->length - 1;
-
- ds_put_cstr(s, "fields=");
- start = s->length;
- oxm_format_field_array(s, &props->fields);
- if (s->length == start) {
- ds_truncate(s, mark);
+ size_t n = bitmap_count1(props->fields.used.bm, MFF_N_IDS);
+ if (n == 1) {
+ ds_put_cstr(s, ",fields=");
+ oxm_format_field_array(s, &props->fields);
+ } else if (n > 1) {
+ ds_put_cstr(s, ",fields(");
+ oxm_format_field_array(s, &props->fields);
+ ds_put_char(s, ')');
}
}
if (bucket->watch_port != OFPP_NONE) {
ds_put_format(s, "watch_port:%"PRIu32",", bucket->watch_port);
}
- if (bucket->watch_group != OFPG11_ANY) {
+ if (bucket->watch_group != OFPG_ANY) {
ds_put_format(s, "watch_group:%"PRIu32",", bucket->watch_group);
}
}
static void
-ofp_print_group_mod(struct ds *s, const struct ofp_header *oh)
+ofp_print_group_mod__(struct ds *s, enum ofp_version ofp_version,
+ const struct ofputil_group_mod *gm)
{
- struct ofputil_group_mod gm;
- int error;
bool bucket_command = false;
- error = ofputil_decode_group_mod(oh, &gm);
- if (error) {
- ofp_print_error(s, error);
- return;
- }
-
ds_put_char(s, '\n');
ds_put_char(s, ' ');
- switch (gm.command) {
+ switch (gm->command) {
case OFPGC11_ADD:
ds_put_cstr(s, "ADD");
break;
break;
default:
- ds_put_format(s, "cmd:%"PRIu16"", gm.command);
+ ds_put_format(s, "cmd:%"PRIu16"", gm->command);
}
ds_put_char(s, ' ');
if (bucket_command) {
ofp_print_bucket_id(s, "command_bucket_id:",
- gm.command_bucket_id, oh->version);
+ gm->command_bucket_id, ofp_version);
}
- ofp_print_group(s, gm.group_id, gm.type, &gm.buckets, &gm.props,
- oh->version, bucket_command);
+ ofp_print_group(s, gm->group_id, gm->type, &gm->buckets, &gm->props,
+ ofp_version, bucket_command);
+}
+
+static void
+ofp_print_group_mod(struct ds *s, const struct ofp_header *oh)
+{
+ struct ofputil_group_mod gm;
+ int error;
+
+ error = ofputil_decode_group_mod(oh, &gm);
+ if (error) {
+ ofp_print_error(s, error);
+ return;
+ }
+ ofp_print_group_mod__(s, oh->version, &gm);
ofputil_bucket_list_destroy(&gm.buckets);
}
bool same_stats = prev_stats && table_stats_equal(stats, prev_stats);
bool same_features = prev_features && table_features_equal(features,
prev_features);
- if ((!stats || same_stats) && (!features || same_features)) {
+ if ((!stats || same_stats) && same_features) {
ds_put_cstr(s, " ditto");
return;
}
ofputil_uninit_geneve_table(>r.mappings);
}
+/* This function will print the request forward message. The reason for
+ * request forward is taken from rf.request.type */
+static void
+ofp_print_requestforward(struct ds *string, const struct ofp_header *oh)
+{
+ struct ofputil_requestforward rf;
+ enum ofperr error;
+
+ error = ofputil_decode_requestforward(oh, &rf);
+ if (error) {
+ ofp_print_error(string, error);
+ return;
+ }
+
+ ds_put_cstr(string, " reason=");
+
+ switch (rf.reason) {
+ case OFPRFR_GROUP_MOD:
+ ds_put_cstr(string, "group_mod");
+ ofp_print_group_mod__(string, oh->version, rf.group_mod);
+ break;
+
+ case OFPRFR_METER_MOD:
+ ds_put_cstr(string, "meter_mod");
+ ofp_print_meter_mod__(string, rf.meter_mod);
+ break;
+ }
+ ofputil_destroy_requestforward(&rf);
+}
+
static void
ofp_to_string__(const struct ofp_header *oh, enum ofpraw raw,
struct ds *string, int verbosity)
ofp_print_role_status_message(string, oh);
break;
+ case OFPTYPE_REQUESTFORWARD:
+ ofp_print_requestforward(string, oh);
+ break;
+
case OFPTYPE_METER_STATS_REQUEST:
case OFPTYPE_METER_CONFIG_STATS_REQUEST:
ofp_print_stats(string, oh);