aboutgitcodebugslistschat
path: root/tcp_splice.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2024-01-16 11:50:42 +1100
committerStefano Brivio <sbrivio@redhat.com>2024-01-22 23:35:33 +0100
commit9c0881d4f6dd651fd2a40896b54d554cb7ba5b2e (patch)
treecde62804974d309221bbfc181aecd3dcc55f2ddd /tcp_splice.c
parent4a849e95267c30e63dbe61c4576c059c927b99d9 (diff)
downloadpasst-9c0881d4f6dd651fd2a40896b54d554cb7ba5b2e.tar
passt-9c0881d4f6dd651fd2a40896b54d554cb7ba5b2e.tar.gz
passt-9c0881d4f6dd651fd2a40896b54d554cb7ba5b2e.tar.bz2
passt-9c0881d4f6dd651fd2a40896b54d554cb7ba5b2e.tar.lz
passt-9c0881d4f6dd651fd2a40896b54d554cb7ba5b2e.tar.xz
passt-9c0881d4f6dd651fd2a40896b54d554cb7ba5b2e.tar.zst
passt-9c0881d4f6dd651fd2a40896b54d554cb7ba5b2e.zip
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>
Diffstat (limited to 'tcp_splice.c')
-rw-r--r--tcp_splice.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/tcp_splice.c b/tcp_splice.c
index 3f6f1b3..daef7de 100644
--- a/tcp_splice.c
+++ b/tcp_splice.c
@@ -244,16 +244,17 @@ void tcp_splice_conn_update(const struct ctx *c, struct tcp_splice_conn *new)
/**
* tcp_splice_flow_defer() - Deferred per-flow handling (clean up closed)
- * @c: Execution context
* @flow: Flow table entry for this connection
+ *
+ * Return: true if the flow is ready to free, false otherwise
*/
-void tcp_splice_flow_defer(const struct ctx *c, union flow *flow)
+bool tcp_splice_flow_defer(union flow *flow)
{
struct tcp_splice_conn *conn = &flow->tcp_splice;
unsigned side;
if (!(flow->tcp_splice.flags & CLOSING))
- return;
+ return false;
for (side = 0; side < SIDES; side++) {
if (conn->events & SPLICE_ESTABLISHED) {
@@ -277,7 +278,7 @@ void tcp_splice_flow_defer(const struct ctx *c, union flow *flow)
conn->flags = 0;
flow_dbg(conn, "CLOSED");
- flow_table_compact(c, flow);
+ return true;
}
/**