mirror of
https://passt.top/passt
synced 2025-06-11 10:05:34 +02:00
flow, tcp: Generalise connection types
Currently TCP connections use a 1-bit selector, 'spliced', to determine the rest of the contents of the structure. We want to generalise the TCP connection table to other types of flows in other protocols. Make a start on this by replacing the tcp_conn_common structure with a new flow_common structure with an enum rather than a simple boolean indicating the type of flow. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
ba84a3b17a
commit
16ae032608
6 changed files with 112 additions and 40 deletions
24
tcp_conn.h
24
tcp_conn.h
|
@ -9,19 +9,9 @@
|
|||
#ifndef TCP_CONN_H
|
||||
#define TCP_CONN_H
|
||||
|
||||
/**
|
||||
* struct tcp_conn_common - Common fields for spliced and non-spliced
|
||||
* @spliced: Is this a spliced connection?
|
||||
*/
|
||||
struct tcp_conn_common {
|
||||
bool spliced :1;
|
||||
};
|
||||
|
||||
extern const char *tcp_common_flag_str[];
|
||||
|
||||
/**
|
||||
* struct tcp_tap_conn - Descriptor for a TCP connection (not spliced)
|
||||
* @c: Fields common with tcp_splice_conn
|
||||
* @f: Generic flow information
|
||||
* @in_epoll: Is the connection in the epoll set?
|
||||
* @next_index: Connection index of next item in hash chain, -1 for none
|
||||
* @tap_mss: MSS advertised by tap/guest, rounded to 2 ^ TCP_MSS_BITS
|
||||
|
@ -46,8 +36,8 @@ extern const char *tcp_common_flag_str[];
|
|||
* @seq_init_from_tap: Initial sequence number from tap
|
||||
*/
|
||||
struct tcp_tap_conn {
|
||||
/* Must be first element to match tcp_splice_conn */
|
||||
struct tcp_conn_common c;
|
||||
/* Must be first element */
|
||||
struct flow_common f;
|
||||
|
||||
bool in_epoll :1;
|
||||
int next_index :TCP_CONN_INDEX_BITS + 2;
|
||||
|
@ -121,7 +111,7 @@ struct tcp_tap_conn {
|
|||
#define SIDES 2
|
||||
/**
|
||||
* struct tcp_splice_conn - Descriptor for a spliced TCP connection
|
||||
* @c: Fields common with tcp_tap_conn
|
||||
* @f: Generic flow information
|
||||
* @in_epoll: Is the connection in the epoll set?
|
||||
* @s: File descriptor for sockets
|
||||
* @pipe: File descriptors for pipes
|
||||
|
@ -131,8 +121,8 @@ struct tcp_tap_conn {
|
|||
* @written: Bytes written (not fully written from one other side read)
|
||||
*/
|
||||
struct tcp_splice_conn {
|
||||
/* Must be first element to match tcp_tap_conn */
|
||||
struct tcp_conn_common c;
|
||||
/* Must be first element */
|
||||
struct flow_common f;
|
||||
|
||||
bool in_epoll :1;
|
||||
int s[SIDES];
|
||||
|
@ -168,7 +158,7 @@ struct tcp_splice_conn {
|
|||
* @splice: Fields specific to spliced connections
|
||||
*/
|
||||
union tcp_conn {
|
||||
struct tcp_conn_common c;
|
||||
struct flow_common f;
|
||||
struct tcp_tap_conn tap;
|
||||
struct tcp_splice_conn splice;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue