ofproto: Correctly report table miss configuration in table stats.
authorBen Pfaff <blp@nicira.com>
Mon, 28 Jul 2014 18:08:36 +0000 (11:08 -0700)
committerBen Pfaff <blp@nicira.com>
Mon, 11 Aug 2014 18:10:53 +0000 (11:10 -0700)
OFPTC11_TABLE_MISS_MASK isn't a valid value at all, let alone always the
value in use.  We should report the value actually in use, as this commit
does.

There is a remaining problem: the default table configuration is
OFPROTO_TABLE_MISS_DEFAULT, which doesn't correspond to any particular
OFPTC11_* value or, more precisely, corresponds to a different OFPTC11_*
value based on the OpenFlow version.  The following commit fixes that
problem.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
ofproto/ofproto-provider.h
ofproto/ofproto.c

index ca17319..4691d87 100644 (file)
@@ -799,7 +799,7 @@ struct ofproto_class {
      *
      *   - 'ovsinsts' to all instructions.
      *
-     *   - 'config' to OFPTC11_TABLE_MISS_MASK.
+     *   - 'config' to the table miss configuration.
      *
      *   - 'max_entries' to 1,000,000.
      *
index ac7cb13..1c9c412 100644 (file)
@@ -3084,6 +3084,8 @@ handle_table_stats_request(struct ofconn *ofconn,
      */
     stats = xcalloc(p->n_tables, sizeof *stats);
     for (i = 0; i < p->n_tables; i++) {
+        unsigned int config;
+
         stats[i].table_id = i;
         sprintf(stats[i].name, "table%"PRIuSIZE, i);
         bitmap_set_multiple(stats[i].match.bm, 0, MFF_N_IDS, 1);
@@ -3095,7 +3097,8 @@ handle_table_stats_request(struct ofconn *ofconn,
         stats[i].metadata_match = OVS_BE64_MAX;
         stats[i].metadata_write = OVS_BE64_MAX;
         stats[i].ovsinsts = (1u << N_OVS_INSTRUCTIONS) - 1;
-        stats[i].config = OFPTC11_TABLE_MISS_MASK;
+        atomic_read(&p->tables[i].config, &config);
+        stats[i].config = config;
         stats[i].max_entries = 1000000; /* An arbitrary big number. */
         stats[i].active_count = classifier_count(&p->tables[i].cls);
     }