mirror of
https://passt.top/passt
synced 2025-06-16 04:15:34 +02:00
flow: Clarify flow entry life cycle, introduce uniform logging
Our allocation scheme for flow entries means there are some non-obvious constraints on when what things can be done with an entry. Add a big doc comment explaining the life cycle. In addition, make a FLOW_START() macro to mark one of the important transitions. This encourages correct usage, by making it natural to only access the flow type specific structure after calling it. It also logs that a new flow has been created, which is useful for debugging. We also add logging when a flow's lifecycle ends. This doesn't need a new helper, because it can only happen either from flow_alloc_cancel() or from the flow deferred handler. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
d0550f97cd
commit
0f938c3b9a
5 changed files with 95 additions and 18 deletions
5
flow.h
5
flow.h
|
@ -45,6 +45,11 @@ struct flow_common {
|
|||
#define FLOW_TABLE_PRESSURE 30 /* % of FLOW_MAX */
|
||||
#define FLOW_FILE_PRESSURE 30 /* % of c->nofile */
|
||||
|
||||
union flow *flow_start(union flow *flow, enum flow_type type,
|
||||
unsigned iniside);
|
||||
#define FLOW_START(flow_, t_, var_, i_) \
|
||||
(&flow_start((flow_), (t_), (i_))->var_)
|
||||
|
||||
/**
|
||||
* struct flow_sidx - ID for one side of a specific flow
|
||||
* @side: Side referenced (0 or 1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue