Add support for exporting flow information in NetFlow v5 format.
[sliver-openvswitch.git] / datapath / table.h
index 3dda276..8be895e 100644 (file)
@@ -8,7 +8,7 @@
 
 struct sw_flow;
 struct sw_flow_key;
-struct ofp_action;
+struct ofp_action_header;
 struct datapath;
 
 /* Table statistics. */
@@ -18,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. */
 };
 
@@ -35,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
@@ -60,13 +62,16 @@ struct sw_table {
         * 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);
+                       const struct ofp_action_header *actions, size_t actions_len);
 
        /* 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. */
-       int (*delete)(struct sw_table *table, const struct sw_flow_key *key, 
-                       uint16_t priority, int strict);
+        * 'table'.  If 'out_port' is not OFPP_NONE, then matching entries
+        * must have that port as an argument for an output action.  If 
+        * 'strict' is set, wildcards and priority must match.  Returns the 
+        * number of flows that were deleted. */
+       int (*delete)(struct datapath *dp, struct sw_table *table, 
+                       const struct sw_flow_key *key, 
+                       uint16_t out_port, uint16_t priority, int strict);
 
        /* Performs timeout processing on all the flow entries in 'table'.
         * Returns the number of flow entries deleted through expiration. */
@@ -76,10 +81,11 @@ struct sw_table {
        void (*destroy)(struct sw_table *table);
 
        /* Iterates through the flow entries in 'table', passing each one
-        * matches 'key' to 'callback'.  The callback function should return 0
-        * to continue iteration or a nonzero error code to stop.  The iterator
-        * function returns either 0 if the table iteration completed or the
-        * value returned by the callback function otherwise.
+        * matches 'key' and output port 'out_port' to 'callback'.  The 
+        * callback function should return 0 to continue iteration or a 
+        * nonzero error code to stop.  The iterator function returns either 
+        * 0 if the table iteration completed or the value returned by the 
+        * callback function otherwise.
         *
         * The iteration starts at 'position', which may be initialized to
         * all-zero-bits to iterate from the beginning of the table.  If the
@@ -89,7 +95,7 @@ struct sw_table {
         * that caused the error (assuming that that flow entry has not been
         * deleted in the meantime). */
        int (*iterate)(struct sw_table *table,
-                      const struct sw_flow_key *key,
+                      const struct sw_flow_key *key, uint16_t out_port,
                       struct sw_table_position *position,
                       int (*callback)(struct sw_flow *flow, void *private),
                       void *private);