mirror of
https://passt.top/passt
synced 2025-06-17 04:35:35 +02:00
flow: Enforce that freeing of closed flows must happen in deferred handlers
Currently, flows are only evern finally freed (and the table compacted) from the deferred handlers. Some future ways we want to optimise managing the flow table will rely on this, so enforce it: rather than having the TCP code directly call flow_table_compact(), add a boolean return value to the per-flow deferred handlers. If true, this indicates that the flow code itself should free the flow. This forces all freeing of flows to occur during the flow code's scan of the table in flow_defer_handler() which opens possibilities for future optimisations. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
4a849e9526
commit
9c0881d4f6
5 changed files with 21 additions and 15 deletions
9
tcp.c
9
tcp.c
|
@ -1304,21 +1304,22 @@ static struct tcp_tap_conn *tcp_hash_lookup(const struct ctx *c,
|
|||
|
||||
/**
|
||||
* tcp_flow_defer() - Deferred per-flow handling (clean up closed connections)
|
||||
* @c: Execution context
|
||||
* @flow: Flow table entry for this connection
|
||||
*
|
||||
* Return: true if the flow is ready to free, false otherwise
|
||||
*/
|
||||
void tcp_flow_defer(const struct ctx *c, union flow *flow)
|
||||
bool tcp_flow_defer(union flow *flow)
|
||||
{
|
||||
const struct tcp_tap_conn *conn = &flow->tcp;
|
||||
|
||||
if (flow->tcp.events != CLOSED)
|
||||
return;
|
||||
return false;
|
||||
|
||||
close(conn->sock);
|
||||
if (conn->timer != -1)
|
||||
close(conn->timer);
|
||||
|
||||
flow_table_compact(c, flow);
|
||||
return true;
|
||||
}
|
||||
|
||||
static void tcp_rst_do(struct ctx *c, struct tcp_tap_conn *conn);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue