From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 58E6C5A005E for ; Fri, 9 Dec 2022 06:42:38 +0100 (CET) Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4NT0KM3Vfbz4xvT; Fri, 9 Dec 2022 16:42:31 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1670564551; bh=W5Cpv43QN0z/x6QeSo1uKe+EdZGM34xnM7Sh3VbLPfw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f/fF/15v7/g2G6aLqAA+KqZ3WjngMoaH8uTMNY+EX8+POSoRNwjCJwqpYPymosXAH yu+oDvTmBsww56kvPPQQG29yf0amq6PEKxLHWClGc9p0MV05SJJ0Xjv+lRzLQN4cmh AWy/SYntVkITPQAg0/hdx1NRA7FNpPbVT55kiQzY= From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH v2 11/18] tcp: Remove redundant and incorrect initialization from *_iov_init() Date: Fri, 9 Dec 2022 16:42:21 +1100 Message-Id: <20221209054228.4085990-12-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221209054228.4085990-1-david@gibson.dropbear.id.au> References: <20221209054228.4085990-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: YK6U7EBWZZFC2R3ZTG5DPF5UJKX2Z2XM X-Message-ID-Hash: YK6U7EBWZZFC2R3ZTG5DPF5UJKX2Z2XM X-MailFrom: dgibson@gandalf.ozlabs.org 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: David Gibson X-Mailman-Version: 3.3.3 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: tcp_sock[46]_iov_init() initialize the length of each iovec buffer to MSS_DEFAULT. That will always be overwritten before use in tcp_data_to_tap, so it's redundant. It also wasn't correct, because it didn't correctly account for the header lengths in all cases. Signed-off-by: David Gibson --- tcp.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tcp.c b/tcp.c index b30e8e6..0920c2a 100644 --- a/tcp.c +++ b/tcp.c @@ -1072,10 +1072,8 @@ static void tcp_sock4_iov_init(void) }; } - for (i = 0, iov = tcp4_l2_iov; i < TCP_FRAMES_MEM; i++, iov++) { + for (i = 0, iov = tcp4_l2_iov; i < TCP_FRAMES_MEM; i++, iov++) iov->iov_base = &tcp4_l2_buf[i].vnet_len; - iov->iov_len = MSS_DEFAULT; - } for (i = 0, iov = tcp4_l2_flags_iov; i < TCP_FRAMES_MEM; i++, iov++) iov->iov_base = &tcp4_l2_flags_buf[i].vnet_len; @@ -1104,10 +1102,8 @@ static void tcp_sock6_iov_init(void) }; } - for (i = 0, iov = tcp6_l2_iov; i < TCP_FRAMES_MEM; i++, iov++) { + for (i = 0, iov = tcp6_l2_iov; i < TCP_FRAMES_MEM; i++, iov++) iov->iov_base = &tcp6_l2_buf[i].vnet_len; - iov->iov_len = MSS_DEFAULT; - } for (i = 0, iov = tcp6_l2_flags_iov; i < TCP_FRAMES_MEM; i++, iov++) iov->iov_base = &tcp6_l2_flags_buf[i].vnet_len; -- 2.38.1