[ovs-dev] [PATCH v2 04/16] ofproto: Correctly report table miss configuration in table stats.

Ben Pfaff blp at nicira.com
Thu Aug 7 23:13:50 UTC 2014


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 at nicira.com>
---
 ofproto/ofproto-provider.h |    2 +-
 ofproto/ofproto.c          |    5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h
index ca17319..4691d87 100644
--- a/ofproto/ofproto-provider.h
+++ b/ofproto/ofproto-provider.h
@@ -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.
      *
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index ac7cb13..1c9c412 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -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);
     }
-- 
1.7.10.4




More information about the dev mailing list