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 046655A0280 for ; Thu, 10 Aug 2023 04:33:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1691634801; bh=LW8ZqXy8tYtQkETrJymAFjBOt5wfVhtkBBt5QgOyRwY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qECFuT/3PPyNJDilzc2Yj0ohaH6hayejU426IA833una9c8uvdntA4py1U1jodf3n YS7t231MevS4K7s1AR9/TvwooXa0DBvajrYYg6u+8ih59L+Tqb6YYcbR7t7ila2RuE HLdW0uqBS4IcOj/n2NnDzMXNv+Xk3ai2b55ss89k= Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4RLrZT2xcKz4wyW; Thu, 10 Aug 2023 12:33:21 +1000 (AEST) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH v2 09/13] epoll: Tiny cleanup to udp_sock_handler() Date: Thu, 10 Aug 2023 12:33:11 +1000 Message-ID: <20230810023315.684784-10-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230810023315.684784-1-david@gibson.dropbear.id.au> References: <20230810023315.684784-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: JJKWHAUTWKK75P7YDQHVBWPKRWGFHHXI X-Message-ID-Hash: JJKWHAUTWKK75P7YDQHVBWPKRWGFHHXI 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: Move the test for c->no_udp into the function itself, rather than in the dispatching switch statement to better localize the UDP specific logic, and make for greated consistency with other handler functions. Signed-off-by: David Gibson --- passt.c | 3 +-- udp.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/passt.c b/passt.c index f7cd376..24bd825 100644 --- a/passt.c +++ b/passt.c @@ -325,8 +325,7 @@ loop: tcp_sock_handler(&c, ref, eventmask, &now); break; case EPOLL_TYPE_UDP: - if (!c.no_udp) - udp_sock_handler(&c, ref, eventmask, &now); + udp_sock_handler(&c, ref, eventmask, &now); break; case EPOLL_TYPE_ICMP: icmp_sock_handler(&c, ref); diff --git a/udp.c b/udp.c index 62f8360..138e7ab 100644 --- a/udp.c +++ b/udp.c @@ -756,7 +756,7 @@ void udp_sock_handler(struct ctx *c, union epoll_ref ref, uint32_t events, struct mmsghdr *mmh_recv; int i, m; - if (!(events & EPOLLIN)) + if (c->no_udp || !(events & EPOLLIN)) return; if (v6) { -- 2.41.0