Added lookup count to ofp_table_stats.
[openvswitch] / datapath / datapath.c
index 8eb066017316a2ec91df16cb4aaec18b1cef3763..0ec226d9dcf061c73428a4bbe2df51d7e69a4b8d 100644 (file)
@@ -696,13 +696,6 @@ static void fill_port_desc(struct net_bridge_port *p, struct ofp_phy_port *desc)
        desc->features = 0;
        desc->speed = 0;
 
-       if (p->port_no < 255) {
-               /* FIXME: this is a layering violation and should really be
-                * done in the secchan, as with OFPC_STP in
-                * OFP_SUPPORTED_CAPABILITIES. */
-               desc->features |= OFPPF_STP;
-       }
-
        spin_lock_irqsave(&p->lock, flags);
        desc->flags = htonl(p->flags | p->status);
        spin_unlock_irqrestore(&p->lock, flags);
@@ -1272,13 +1265,14 @@ static int flow_stats_init(struct datapath *dp, const void *body, int body_len,
 
 static int flow_stats_dump_callback(struct sw_flow *flow, void *private)
 {
+       struct sw_flow_actions *sf_acts = rcu_dereference(flow->sf_acts);
        struct flow_stats_state *s = private;
        struct ofp_flow_stats *ofs;
        int actions_length;
        int length;
 
-       actions_length = sizeof *ofs->actions * flow->n_actions;
-       length = sizeof *ofs + sizeof *ofs->actions * flow->n_actions;
+       actions_length = sizeof *ofs->actions * sf_acts->n_actions;
+       length = sizeof *ofs + actions_length;
        if (length + s->bytes_used > s->bytes_allocated)
                return 1;
 
@@ -1305,7 +1299,7 @@ static int flow_stats_dump_callback(struct sw_flow *flow, void *private)
        memset(ofs->pad2, 0, sizeof ofs->pad2);
        ofs->packet_count    = cpu_to_be64(flow->packet_count);
        ofs->byte_count      = cpu_to_be64(flow->byte_count);
-       memcpy(ofs->actions, flow->actions, actions_length);
+       memcpy(ofs->actions, sf_acts->actions, actions_length);
 
        s->bytes_used += length;
        return 0;
@@ -1426,6 +1420,7 @@ static int table_stats_dump(struct datapath *dp, void *state,
                memset(ots->pad, 0, sizeof ots->pad);
                ots->max_entries = htonl(stats.max_flows);
                ots->active_count = htonl(stats.n_flows);
+               ots->lookup_count = cpu_to_be64(stats.n_lookup);
                ots->matched_count = cpu_to_be64(stats.n_matched);
        }
        return 0;