flow: Properly type callbacks to protocol specific handlers
The flow dispatches deferred and timer handling for flows centrally, but needs to call into protocol specific code for the handling of individual flows. Currently this passes a general union flow *. It makes more sense to pass the specific relevant flow type structure. That brings the check on the flow type adjacent to casting to the union variant which it tags. Arguably, this is a slight abstraction violation since it involves the generic flow code using protocol specific types. It's already calling into protocol specific functions, so I don't think this really makes any difference. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
committed by
Stefano Brivio
parent
1a20370b36
commit
7a832a8a0e
12
tcp_splice.c
12
tcp_splice.c
@@ -235,16 +235,15 @@ static void conn_event_do(const struct ctx *c, struct tcp_splice_conn *conn,
|
||||
|
||||
/**
|
||||
* tcp_splice_flow_defer() - Deferred per-flow handling (clean up closed)
|
||||
* @flow: Flow table entry for this connection
|
||||
* @conn: Connection entry to handle
|
||||
*
|
||||
* Return: true if the flow is ready to free, false otherwise
|
||||
*/
|
||||
bool tcp_splice_flow_defer(union flow *flow)
|
||||
bool tcp_splice_flow_defer(struct tcp_splice_conn *conn)
|
||||
{
|
||||
struct tcp_splice_conn *conn = &flow->tcp_splice;
|
||||
unsigned side;
|
||||
|
||||
if (!(flow->tcp_splice.flags & CLOSING))
|
||||
if (!(conn->flags & CLOSING))
|
||||
return false;
|
||||
|
||||
for (side = 0; side < SIDES; side++) {
|
||||
@@ -786,11 +785,10 @@ void tcp_splice_init(struct ctx *c)
|
||||
/**
|
||||
* tcp_splice_timer() - Timer for spliced connections
|
||||
* @c: Execution context
|
||||
* @flow: Flow table entry
|
||||
* @conn: Connection to handle
|
||||
*/
|
||||
void tcp_splice_timer(const struct ctx *c, union flow *flow)
|
||||
void tcp_splice_timer(const struct ctx *c, struct tcp_splice_conn *conn)
|
||||
{
|
||||
struct tcp_splice_conn *conn = &flow->tcp_splice;
|
||||
int side;
|
||||
|
||||
ASSERT(!(conn->flags & CLOSING));
|
||||
|
||||
Reference in New Issue
Block a user