epoll: Split handling of listening TCP sockets into their own handler
tcp_sock_handler() handles both listening TCP sockets, and connected TCP sockets, but what it needs to do in those cases has essentially nothing in common. Therefore, give listening sockets their own epoll_type value and dispatch directly to their own handler from the top level. Furthermore, the two handlers need essentially entirely different information from the reference: we re-(ab)used the index field in the tcp_epoll_ref to indicate the port for the listening socket, but that's not the same meaning. So, switch listening sockets to their own reference type which we can lay out as we please. That lets us remove the listen and outbound fields from the normal (connected) tcp_epoll_ref, reducing it to just the connection table index. 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
e6f81e5578
commit
485b5fb8f9
@@ -486,7 +486,7 @@ static void tcp_splice_dir(struct tcp_splice_conn *conn, int ref_sock,
|
||||
* Return: true if able to create a spliced connection, false otherwise
|
||||
* #syscalls:pasta setsockopt
|
||||
*/
|
||||
bool tcp_splice_conn_from_sock(struct ctx *c, union epoll_ref ref,
|
||||
bool tcp_splice_conn_from_sock(struct ctx *c, union tcp_listen_epoll_ref ref,
|
||||
struct tcp_splice_conn *conn, int s,
|
||||
const struct sockaddr *sa)
|
||||
{
|
||||
@@ -516,7 +516,7 @@ bool tcp_splice_conn_from_sock(struct ctx *c, union epoll_ref ref,
|
||||
c->tcp.splice_conn_count++;
|
||||
conn->a = s;
|
||||
|
||||
if (tcp_splice_new(c, conn, ref.tcp.index, ref.tcp.outbound))
|
||||
if (tcp_splice_new(c, conn, ref.port, ref.ns))
|
||||
conn_flag(c, conn, CLOSING);
|
||||
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user