mirror of
https://passt.top/passt
synced 2025-06-10 09:35:34 +02:00
flow, tcp: Add flow-centric dispatch for deferred flow handling
tcp_defer_handler(), amongst other things, scans the flow table and does some processing for each TCP connection. When we add other protocols to the flow table, they're likely to want some similar scanning. It makes more sense for cache friendliness to perform a single scan of the flow table and dispatch to the protocol specific handlers, rather than having each protocol separately scan the table. To that end, add a new flow_defer_handler() handling all flow-linked deferred operations. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
c97bb527d6
commit
b43e4483ed
5 changed files with 28 additions and 17 deletions
23
flow.c
23
flow.c
|
@ -84,3 +84,26 @@ void flow_log_(const struct flow_common *f, int pri, const char *fmt, ...)
|
|||
|
||||
logmsg(pri, "Flow %u (%s): %s", flow_idx(f), FLOW_TYPE(f), msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* flow_defer_handler() - Handler for per-flow deferred tasks
|
||||
* @c: Execution context
|
||||
*/
|
||||
void flow_defer_handler(struct ctx *c)
|
||||
{
|
||||
union flow *flow;
|
||||
|
||||
for (flow = flowtab + c->flow_count - 1; flow >= flowtab; flow--) {
|
||||
switch (flow->f.type) {
|
||||
case FLOW_TCP:
|
||||
tcp_flow_defer(c, flow);
|
||||
break;
|
||||
case FLOW_TCP_SPLICE:
|
||||
tcp_splice_flow_defer(c, flow);
|
||||
break;
|
||||
default:
|
||||
/* Assume other flow types don't need any handling */
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue