X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=datapath%2Fflow.h;h=d1ac85a0b53f59c591e58584514b745e27ed1093;hb=b0b906ccf485f8342e7be4f976f14d2a235e0a69;hp=91a3022cde6456bf9f2452b54b5422e0d8ff55a3;hpb=8621547cc94ad91018ac0b662427a6fa20165a8d;p=sliver-openvswitch.git diff --git a/datapath/flow.h b/datapath/flow.h index 91a3022cd..d1ac85a0b 100644 --- a/datapath/flow.h +++ b/datapath/flow.h @@ -19,6 +19,7 @@ #ifndef FLOW_H #define FLOW_H 1 +#include #include #include #include @@ -146,6 +147,14 @@ struct sw_flow_actions { struct nlattr actions[]; }; +struct sw_flow_stats { + u64 packet_count; /* Number of packets matched. */ + u64 byte_count; /* Number of bytes matched. */ + unsigned long used; /* Last used time (in jiffies). */ + spinlock_t lock; /* Lock for atomic stats update. */ + u8 tcp_flags; /* Union of seen TCP flags. */ +} ____cacheline_aligned_in_smp; + struct sw_flow { struct rcu_head rcu; struct hlist_node hash_node[2]; @@ -155,12 +164,7 @@ struct sw_flow { struct sw_flow_key unmasked_key; struct sw_flow_mask *mask; struct sw_flow_actions __rcu *sf_acts; - - spinlock_t lock; /* Lock for values below. */ - unsigned long used; /* Last used time (in jiffies). */ - u64 packet_count; /* Number of packets matched. */ - u64 byte_count; /* Number of bytes matched. */ - u8 tcp_flags; /* Union of seen TCP flags. */ + struct sw_flow_stats stats[]; }; struct arp_eth_header { @@ -177,7 +181,9 @@ struct arp_eth_header { unsigned char ar_tip[4]; /* target IP address */ } __packed; -void ovs_flow_used(struct sw_flow *, struct sk_buff *); +void ovs_flow_stats_update(struct sw_flow *flow, struct sk_buff *skb); +void ovs_flow_stats_get(struct sw_flow *flow, struct sw_flow_stats *res); +void ovs_flow_stats_clear(struct sw_flow *flow); u64 ovs_flow_used_time(unsigned long flow_jiffies); int ovs_flow_extract(struct sk_buff *, u16 in_port, struct sw_flow_key *);