mirror of
https://passt.top/passt
synced 2025-06-16 04:15:34 +02:00
tcp: Add connection union type
Currently, the tables for spliced and non-spliced connections are entirely separate, with different types in different arrays. We want to unify them. As a first step, create a union type which can represent either a spliced or non-spliced connection. For them to be distinguishable, the individual types need to have a common header added, with a bit indicating which type this structure is. This comes at the cost of increasing the size of tcp_tap_conn to over one (64 byte) cacheline. This isn't ideal, but it makes things simpler for now and we'll re-optimize this later. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
3cf027bd59
commit
ff27fd63cd
3 changed files with 36 additions and 0 deletions
4
tcp.c
4
tcp.c
|
@ -288,6 +288,7 @@
|
|||
#include <sys/uio.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <linux/tcp.h> /* For struct tcp_info */
|
||||
|
||||
|
@ -601,6 +602,7 @@ static inline struct tcp_tap_conn *conn_at_idx(int index)
|
|||
{
|
||||
if ((index < 0) || (index >= TCP_MAX_CONNS))
|
||||
return NULL;
|
||||
assert(!(CONN(index)->c.spliced));
|
||||
return CONN(index);
|
||||
}
|
||||
|
||||
|
@ -2096,6 +2098,7 @@ static void tcp_conn_from_tap(struct ctx *c, int af, const void *addr,
|
|||
}
|
||||
|
||||
conn = CONN(c->tcp.conn_count++);
|
||||
conn->c.spliced = false;
|
||||
conn->sock = s;
|
||||
conn->timer = -1;
|
||||
conn_event(c, conn, TAP_SYN_RCVD);
|
||||
|
@ -2764,6 +2767,7 @@ static void tcp_conn_from_sock(struct ctx *c, union epoll_ref ref,
|
|||
return;
|
||||
|
||||
conn = CONN(c->tcp.conn_count++);
|
||||
conn->c.spliced = false;
|
||||
conn->sock = s;
|
||||
conn->timer = -1;
|
||||
conn->ws_to_tap = conn->ws_from_tap = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue