From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 68E5A5A0283 for ; Mon, 27 Nov 2023 00:34:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1701041631; bh=IYrJipxz0v8VD/YE+SAWZGL7x9tyybuT2ijMybdb7xw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ionbjf58lGJJJQQ47z0zGWpXYpdhZFTlhYkuZyOKCKIh9H/+AVr25CH3/4RbMxe14 x5fKCl+x1hiezApGHlU6soRyxRrw6FYk36VPqBJNgKvZSqpJ7sIc16zdJPWg6X5WwP f3cQU1rpUtxctbYnlx8pfHRRTMG1PaKEizKV5thY= Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4SdlR320yDz4x2V; Mon, 27 Nov 2023 10:33:51 +1100 (AEDT) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH v2 08/11] tcp: Remove unneccessary bounds check in tcp_timer_handler() Date: Mon, 27 Nov 2023 10:33:45 +1100 Message-ID: <20231126233348.1599864-9-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231126233348.1599864-1-david@gibson.dropbear.id.au> References: <20231126233348.1599864-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: J3OBREZUT7PGPYTQ6ZMSHC7UM6MKXUQG X-Message-ID-Hash: J3OBREZUT7PGPYTQ6ZMSHC7UM6MKXUQG 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.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: In tcp_timer_handler() we use conn_at_idx() to interpret the flow index from the epoll reference. However, this will never be NULL - we always put a valid index into the epoll_ref. Simplify slightly based on this. Signed-off-by: David Gibson --- tcp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tcp.c b/tcp.c index f427047..512baf3 100644 --- a/tcp.c +++ b/tcp.c @@ -2759,10 +2759,10 @@ void tcp_listen_handler(struct ctx *c, union epoll_ref ref, */ void tcp_timer_handler(struct ctx *c, union epoll_ref ref) { - struct tcp_tap_conn *conn = conn_at_idx(ref.tcp.index); struct itimerspec check_armed = { { 0 }, { 0 } }; + struct tcp_tap_conn *conn = CONN(ref.tcp.index); - if (c->no_tcp || !conn) + if (c->no_tcp) return; /* We don't reset timers on ~ACK_FROM_TAP_DUE, ~ACK_TO_TAP_DUE. If the -- 2.43.0