Skip to content

Commit

Permalink
ofp-table: Always format the table number in table features.
Browse files Browse the repository at this point in the history
Table features should indicate the table number as well as the table
name.  Before this, the first line for each table looked like this:
   table myname ("myname"):
but it's more useful if it's:
   table 123 ("myname"):

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
  • Loading branch information
blp committed Oct 26, 2018
1 parent dccab9b commit b47e7e2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
1 change: 0 additions & 1 deletion include/openvswitch/ofp-table.h
Expand Up @@ -276,7 +276,6 @@ void ofputil_table_features_format(
const struct ofputil_table_features *prev_features,
const struct ofputil_table_stats *stats,
const struct ofputil_table_stats *prev_stats,
const struct ofputil_table_map *table_map,
int *first_ditto, int *last_ditto);
void ofputil_table_features_format_finish(struct ds *,
int first_ditto, int last_ditto);
Expand Down
14 changes: 6 additions & 8 deletions lib/ofp-print.c
Expand Up @@ -226,8 +226,7 @@ ofp_print_get_config_reply(struct ds *string, const struct ofp_header *oh)
}

static enum ofperr
ofp_print_table_features_reply(struct ds *s, const struct ofp_header *oh,
const struct ofputil_table_map *table_map)
ofp_print_table_features_reply(struct ds *s, const struct ofp_header *oh)
{
struct ofpbuf b = ofpbuf_const_initializer(oh, ntohs(oh->length));

Expand All @@ -244,7 +243,7 @@ ofp_print_table_features_reply(struct ds *s, const struct ofp_header *oh,
}

ofputil_table_features_format(s, &tf, i ? &prev : NULL, NULL, NULL,
table_map, &first_ditto, &last_ditto);
&first_ditto, &last_ditto);
prev = tf;
}
}
Expand Down Expand Up @@ -567,8 +566,7 @@ ofp_print_ofpst_port_reply(struct ds *string, const struct ofp_header *oh,
}

static enum ofperr
ofp_print_table_stats_reply(struct ds *string, const struct ofp_header *oh,
const struct ofputil_table_map *table_map)
ofp_print_table_stats_reply(struct ds *string, const struct ofp_header *oh)
{
struct ofpbuf b = ofpbuf_const_initializer(oh, ntohs(oh->length));
ofpraw_pull_assert(&b);
Expand All @@ -591,7 +589,7 @@ ofp_print_table_stats_reply(struct ds *string, const struct ofp_header *oh,
ofputil_table_features_format(string,
&features, i ? &prev_features : NULL,
&stats, i ? &prev_stats : NULL,
table_map, &first_ditto, &last_ditto);
&first_ditto, &last_ditto);
prev_features = features;
prev_stats = stats;
}
Expand Down Expand Up @@ -991,7 +989,7 @@ ofp_to_string__(const struct ofp_header *oh,

case OFPTYPE_TABLE_FEATURES_STATS_REQUEST:
case OFPTYPE_TABLE_FEATURES_STATS_REPLY:
return ofp_print_table_features_reply(string, oh, table_map);
return ofp_print_table_features_reply(string, oh);

case OFPTYPE_TABLE_DESC_REQUEST:
case OFPTYPE_TABLE_DESC_REPLY:
Expand Down Expand Up @@ -1114,7 +1112,7 @@ ofp_to_string__(const struct ofp_header *oh,
return ofp_print_ofpst_port_reply(string, oh, port_map, verbosity);

case OFPTYPE_TABLE_STATS_REPLY:
return ofp_print_table_stats_reply(string, oh, table_map);
return ofp_print_table_stats_reply(string, oh);

case OFPTYPE_AGGREGATE_STATS_REPLY:
return ofp_print_aggregate_stats_reply(string, oh);
Expand Down
4 changes: 1 addition & 3 deletions lib/ofp-table.c
Expand Up @@ -1432,7 +1432,6 @@ ofputil_table_features_format(
const struct ofputil_table_features *prev_features,
const struct ofputil_table_stats *stats,
const struct ofputil_table_stats *prev_stats,
const struct ofputil_table_map *table_map,
int *first_ditto, int *last_ditto)
{
int table = features->table_id;
Expand All @@ -1452,8 +1451,7 @@ ofputil_table_features_format(
ofputil_table_features_format_finish(s, *first_ditto, *last_ditto);
*first_ditto = -1;

ds_put_format(s, "\n table ");
ofputil_format_table(table, table_map, s);
ds_put_format(s, "\n table %"PRIu8, table);
if (features->name[0]) {
ds_put_format(s, " (\"%s\")", features->name);
}
Expand Down
1 change: 0 additions & 1 deletion utilities/ovs-ofctl.c
Expand Up @@ -926,7 +926,6 @@ ofctl_dump_table_features(struct ovs_cmdl_context *ctx)

ofputil_table_features_format(
&s, &tf, n ? &prev : NULL, NULL, NULL,
tables_to_show(ctx->argv[1]),
&first_ditto, &last_ditto);

prev = tf;
Expand Down

0 comments on commit b47e7e2

Please sign in to comment.