From 433604a581604fe8acfa9a9022b9c29305642ab7 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Thu, 17 Nov 2022 16:58:49 +1100 Subject: tcp: Unify the IN_EPOLL flag There is very little common between the tcp_tap_conn and tcp_splice_conn structures. However, both do have an IN_EPOLL flag which has the same meaning in each case, though it's stored in a different location. Simplify things slightly by moving this bit into the common header of the two structures. Signed-off-by: David Gibson Signed-off-by: Stefano Brivio --- tcp_splice.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tcp_splice.c') diff --git a/tcp_splice.c b/tcp_splice.c index 0ac316d..7a06252 100644 --- a/tcp_splice.c +++ b/tcp_splice.c @@ -83,8 +83,8 @@ static const char *tcp_splice_event_str[] __attribute((__unused__)) = { /* Display strings for connection flags */ static const char *tcp_splice_flag_str[] __attribute((__unused__)) = { - "SPLICE_V6", "SPLICE_IN_EPOLL", "RCVLOWAT_SET_A", "RCVLOWAT_SET_B", - "RCVLOWAT_ACT_A", "RCVLOWAT_ACT_B", "CLOSING", + "SPLICE_V6", "RCVLOWAT_SET_A", "RCVLOWAT_SET_B", "RCVLOWAT_ACT_A", + "RCVLOWAT_ACT_B", "CLOSING", }; /** @@ -164,7 +164,7 @@ static void conn_flag_do(const struct ctx *c, struct tcp_splice_conn *conn, static int tcp_splice_epoll_ctl(const struct ctx *c, struct tcp_splice_conn *conn) { - int m = (conn->flags & SPLICE_IN_EPOLL) ? EPOLL_CTL_MOD : EPOLL_CTL_ADD; + int m = conn->c.in_epoll ? EPOLL_CTL_MOD : EPOLL_CTL_ADD; union epoll_ref ref_a = { .r.proto = IPPROTO_TCP, .r.s = conn->a, .r.p.tcp.tcp.splice = 1, .r.p.tcp.tcp.index = CONN_IDX(conn), @@ -188,7 +188,7 @@ static int tcp_splice_epoll_ctl(const struct ctx *c, epoll_ctl(c->epollfd, m, conn->b, &ev_b)) goto delete; - conn->flags |= SPLICE_IN_EPOLL; /* No need to log this */ + conn->c.in_epoll = true; return 0; -- cgit v1.2.3