On Fri, 2 Feb 2024 15:11:36 +0100 Laurent Vivier <lvivier(a)redhat.com> wrote:Signed-off-by: Laurent Vivier <lvivier(a)redhat.com> --- tcp.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tcp.c b/tcp.c index 20ad8a4e5271..cdbceed65033 100644 --- a/tcp.c +++ b/tcp.c @@ -1813,6 +1813,14 @@ int tcp_conn_new_sock(const struct ctx *c, sa_family_t af) return s; } +static uint16_t tcp_buf_conn_tap_mss(const struct tcp_tap_conn *conn)I was trying to propose a more descriptive name for this, then I realised I don't understand why you need it: tcp_vu_conn_tap_mss(), added in 22/24, simply returns USHRT_MAX. But then can't we just do something like: if (c->mode == MODE_VU) mss = MIN(MSS_VU, mss); else if (CONN_V4(conn) ... with #define MSS_VU USHRT_MAX?+{ + if (CONN_V4(conn)) + return MSS4; + + return MSS6; +} + /** * tcp_conn_tap_mss() - Get MSS value advertised by tap/guest * @conn: Connection pointer @@ -1832,10 +1840,7 @@ static uint16_t tcp_conn_tap_mss(const struct tcp_tap_conn *conn, else mss = ret; - if (CONN_V4(conn)) - mss = MIN(MSS4, mss); - else - mss = MIN(MSS6, mss); + mss = MIN(tcp_buf_conn_tap_mss(conn), mss); return MIN(mss, USHRT_MAX); }-- Stefano