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 603BA5A0271 for ; Mon, 7 Aug 2023 15:46:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1691415994; bh=4wEDo/obB9BjB82cLI5w1dKmZBviXn+rEwIs0Sp0t3Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FYKJzCE/1mQahCKkyacGLsDEEC6cLHHqAjfazk5jSat30Xuc9jgmUvDUfjOeFVD5N 5/LHY2eJ+klzQzCtDraT/4FAKTh3JNHH98c20eg1EiTznqphgDEVFiHFvMgSx1Tktx yU7Bpe63U5RijFt1PnburYhTlGiselZ4YPCMTQdo= Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4RKHff0yfQz4wyJ; Mon, 7 Aug 2023 23:46:34 +1000 (AEST) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH 5/9] epoll: Tiny cleanup to udp_sock_handler() Date: Mon, 7 Aug 2023 23:46:27 +1000 Message-ID: <20230807134631.1400119-6-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230807134631.1400119-1-david@gibson.dropbear.id.au> References: <20230807134631.1400119-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: QCOLM5NYTPPHCROLCYM5I5TAOWNZW5N5 X-Message-ID-Hash: QCOLM5NYTPPHCROLCYM5I5TAOWNZW5N5 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 33c2162..c7d7f56 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