diff options
| author | Jesse Gross <jesse@nicira.com> | 2010-08-29 09:49:51 -0700 |
|---|---|---|
| committer | Jesse Gross <jesse@nicira.com> | 2010-09-22 13:43:01 -0700 |
| commit | fb8c93473efacd67a50117d0f2a3084f2d96ceca (patch) | |
| tree | 7571fc5795d97e7e937bc3ae289ad9d183b558f2 /datapath/flow.h | |
| parent | 560e802229f3028c02273435dd1c6efba33e0949 (diff) | |
| download | openvswitch-fb8c93473efacd67a50117d0f2a3084f2d96ceca.tar.gz | |
datapath: Add ref counting for flows.
Currently flows are only used within the confines of one
rcu_read_lock()/rcu_read_unlock() session. However, with the
addition of header caching we will need to hold references to flows
for longer periods of time. This adds support for that by adding
refcounts to flows. RCU is still used for normal packet handling
to avoid a performance impact from constantly updating the refcount.
However, instead of directly freeing the flow after a grace period
we simply decrement the refcount.
Signed-off-by: Jesse Gross <jesse@nicira.com>
Reviewed-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'datapath/flow.h')
| -rw-r--r-- | datapath/flow.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/datapath/flow.h b/datapath/flow.h index 484ca1207..3f434677b 100644 --- a/datapath/flow.h +++ b/datapath/flow.h @@ -36,6 +36,9 @@ struct sw_flow { struct odp_flow_key key; struct sw_flow_actions *sf_acts; + atomic_t refcnt; + bool dead; + spinlock_t lock; /* Lock for values below. */ unsigned long used; /* Last used time (in jiffies). */ u64 packet_count; /* Number of packets matched. */ @@ -62,13 +65,15 @@ int flow_init(void); void flow_exit(void); struct sw_flow *flow_alloc(void); -void flow_free(struct sw_flow *flow); void flow_deferred_free(struct sw_flow *); void flow_free_tbl(struct tbl_node *); struct sw_flow_actions *flow_actions_alloc(size_t n_actions); void flow_deferred_free_acts(struct sw_flow_actions *); +void flow_hold(struct sw_flow *); +void flow_put(struct sw_flow *); + int flow_extract(struct sk_buff *, u16 in_port, struct odp_flow_key *); void flow_used(struct sw_flow *, struct sk_buff *); |
