Added lookup count to ofp_table_stats.
[openvswitch] / datapath / table.h
index c47e1e60c803814cfe7dd70e47b43024d6f9a6d1..c40b4ca67802ddc8046922e7e3c86dbe44678507 100644 (file)
@@ -8,6 +8,7 @@
 
 struct sw_flow;
 struct sw_flow_key;
+struct ofp_action;
 struct datapath;
 
 /* Table statistics. */
@@ -17,6 +18,7 @@ struct sw_table_stats {
                                        supported by the table. */
        unsigned int n_flows;        /* Number of active flows. */
        unsigned int max_flows;      /* Flow capacity. */
+       unsigned long int n_lookup;  /* Number of packets looked up. */
        unsigned long int n_matched; /* Number of packets that have hit. */
 };
 
@@ -34,10 +36,11 @@ struct sw_table_position {
  * rcu_read_lock.  destroy must be fully serialized.
  */
 struct sw_table {
-       /* Keep track of the number of packets that matched this table.  To
-        * make this 100% accurate, it should be atomic.  However, we're
-        * primarily concerned about speed. */
-       unsigned long int n_matched;
+       /* The number of packets that have been looked up and matched,
+        * respecitvely.  To make these 100% accurate, they should be atomic.  
+        * However, we're primarily concerned about speed. */
+       unsigned long long n_lookup;
+       unsigned long long n_matched;
 
        /* Searches 'table' for a flow matching 'key', which must not have any
         * wildcard fields.  Returns the flow if successful, a null pointer
@@ -54,6 +57,13 @@ struct sw_table {
         * retained by the caller. */
        int (*insert)(struct sw_table *table, struct sw_flow *flow);
 
+       /* Modifies the actions in 'table' that match 'key'.  If 'strict'
+        * set, wildcards and priority must match.  Returns the number of flows 
+        * that were modified. */
+       int (*modify)(struct sw_table *table, const struct sw_flow_key *key,
+                       uint16_t priority, int strict,
+                       const struct ofp_action *actions, int n_actions);
+
        /* Deletes from 'table' any and all flows that match 'key' from
         * 'table'.  If 'strict' set, wildcards and priority must match.  
         * Returns the number of flows that were deleted. */