From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTP id 46A6F5A026D for ; Thu, 8 Feb 2024 18:00:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707411603; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QcRl2vY+oILwEgAWcbB4KbLdXhc8D/2Z13rr2YEaaik=; b=gGUloAGW3Q17trjI6q+qNC+mZd0pWQlXuLvz2pRzZCuyJ59HIHu7aT5xcLvEYp3EYXdY18 cRrOfKvHDPwKTuxKjfpmwGFp5EJ18TgbD+OdG6NPvLUGO3P1SwQuw4wouh2GBtlLzY/uQU EWBLJ2avtyI6fCrMZhYdP2LG557NmMg= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-659-syiPXFbnO0GpCph2M6GMTw-1; Thu, 08 Feb 2024 12:00:01 -0500 X-MC-Unique: syiPXFbnO0GpCph2M6GMTw-1 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-a2bffe437b5so128692166b.1 for ; Thu, 08 Feb 2024 09:00:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707411600; x=1708016400; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=QcRl2vY+oILwEgAWcbB4KbLdXhc8D/2Z13rr2YEaaik=; b=Qim6CFabT7S3MS07R6B3HsEkK7ZZJiW4Ebe7rW9U0BKvgOwIXXbbQoVMS/OUy/uGPQ jLHuvgmEuAnZ7o+5GpogMBH4ERtqD7fnHKk7z8DDSWvpCjV8bpNz1XNsE9sNJLxVyXYc cEzba80Gi2G2Wrd0FxacPsW9fKCY2evcwj4wNqDmdIcdNInp/Q4uMDADt2FCLwKI01PB O+Oh6LI8WRuEmWo1Bso3jBp7ytKMHen64m812eUol+8fyXMzLVHu7IDiiu3s4ZANHejE vDs1/cmN4ZFA9kCUV0M2vy5I7NK/qzl8rkxj6aOPqh152RVTgMr6Rrhx7XYljb14cMlT tprw== X-Gm-Message-State: AOJu0YyFnEWFMmGJWqiVkujW/DQU4IENAZMqWz3DoaEavWoDhbfBeNLe v682gma5hsw7Ntp94Pye2oPtxLKslp3eUQoNSOu5cr50LEJ9sZLFPfyD31LjKPVdKXaMp08bcVo X/nkPDBFirZypV5Z75czVsIvPXBZuTQ46tgsHMY+HdOCtOfBpbOmMRSWYTpeYt2Rd7nve8bKKnJ LliA1MTJ8h9qyIgltH2EN/PT0T/oxAyctWXWo= X-Received: by 2002:a17:907:392:b0:a37:7fd:9a18 with SMTP id ss18-20020a170907039200b00a3707fd9a18mr6227055ejb.10.1707411599894; Thu, 08 Feb 2024 08:59:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IGyoWXySknUuh5lNj1vItgeIqdXepRoOa+0UJsoVy8PpBxkDnkWm/LsBvWncMByl8FHxbgJ3w== X-Received: by 2002:a17:907:392:b0:a37:7fd:9a18 with SMTP id ss18-20020a170907039200b00a3707fd9a18mr6227046ejb.10.1707411599658; Thu, 08 Feb 2024 08:59:59 -0800 (PST) Received: from maya.cloud.tilaa.com (maya.cloud.tilaa.com. [164.138.29.33]) by smtp.gmail.com with ESMTPSA id y11-20020a17090629cb00b00a3af8158bd7sm235279eje.67.2024.02.08.08.59.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Feb 2024 08:59:59 -0800 (PST) Date: Thu, 8 Feb 2024 17:59:24 +0100 From: Stefano Brivio To: Laurent Vivier Subject: Re: [PATCH 09/24] tcp: extract buffer management from tcp_conn_tap_mss() Message-ID: <20240208175924.72a865c7@elisabeth> In-Reply-To: <20240202141151.3762941-10-lvivier@redhat.com> References: <20240202141151.3762941-1-lvivier@redhat.com> <20240202141151.3762941-10-lvivier@redhat.com> Organization: Red Hat X-Mailer: Claws Mail 4.1.1 (GTK 3.24.36; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: VKLQ4E5HSISWMITNHY2G6MAMDAAKTYPE X-Message-ID-Hash: VKLQ4E5HSISWMITNHY2G6MAMDAAKTYPE X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Fri, 2 Feb 2024 15:11:36 +0100 Laurent Vivier wrote: > Signed-off-by: Laurent Vivier > --- > 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