From nobody Fri Jan 16 09:29:55 2026 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4dsvhN1FTRz6P26x for ; Fri, 16 Jan 2026 09:29:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dsvhN00fdz3cnd for ; Fri, 16 Jan 2026 09:29:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1768555796; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TD5RO7pTKFktmhgu28w1+EI92bszH51hXTZbWUO820o=; b=gLji438V4FjLQXbR67KN5A+Ad9AmJ57t8LNmiDD6LxPXvoOXjmAiVIxla7ilpU5ossHo6V HdkwvoOas+Gwsen3aHFlhHmNcocGr3sR51ythkVkMoGQGV7hrFb3q68vz++bxvCFMGJg3F HlIZVGPyaR0Dy6J1b8Y+FJGPDiGt65vL6f04S40cI38mpVrn4Za17jjOgTjQuWBES015Hg 9dXG59julee8i2xX6sKsTeXWmO2zSvEH4MYa37xVby2HhXcqJjt+4QbIl5tJb8E/xusxaz Z5d/HZb/uoVkYm8y/kI4hwhHOSIrOubmVXV6bBP2LjfpoUADKHSONv59b27fCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1768555796; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TD5RO7pTKFktmhgu28w1+EI92bszH51hXTZbWUO820o=; b=k4dwvn4GFf7zbqckSHJXfwGOaYBIbKIsjkhh58kL49o46MkCd+r0QCwengTgswiPRdMqeH 2iT7GGONUhRNmAEcKoHYVFw64oG3Q/1UKphmrt5uA005UTHxiyLkqkHUwbL7UxuAN0KHk2 jOTC+kFUsumZukBMa8gHjgiS1O83A0rG5ENDZ70FXI9Q1uOTIOCu6pX0tslkIzg+Nodhiw X4mXQV9H8PD7XkffvretHunuqdZuOBBMvgsIFaDoaTUgz9pVMR9CsNgT2xWc9/t5mVVFoY ofhs8OV4Bdsc4efgqeTwqw9ITBmO34Qb8v7lvN5jvYwrZh5XABseEKCcAj5zkQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1768555796; a=rsa-sha256; cv=none; b=V/n8XFqXxlHyVXCaONkRxnLlBtkWfMim9062bjcfaVELoaA1MWzKd1VFP0CS3gLXfxLG6/ Igq3ECvbqhN4i4YwdqCPHqjBmnOWpMMD+Eh9/6gb4IEDGpvOOX8oo7m5IVwrZfNYOsSWje 54bJJadsGpR0cv/kT/AOM5vahrPV1l5gcmYqOqo3ndRK1w5KOLHOr4+7jCcOR2EHBl8qQm zgEyXC3vzcDlO0CrAo51S1+MxhP1nRTD5Amh7pbgZ8y0CCmizfQZ8tqHWQoviK9JGf08a7 nGBJnsWZnVlDeo3NQ3P8M5qiw3sYxBkPe637FdWVGGdaHFKMwDLTRiPoW0R8Wg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dsvhM6hzpz17b9 for ; Fri, 16 Jan 2026 09:29:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 21585 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 16 Jan 2026 09:29:55 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Brooks Davis Subject: git: 296ebf7b8a50 - stable/14 - iflib: remove convoluted custom zeroing code List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 296ebf7b8a50b24b4950b7bd92e170ee224e6671 Auto-Submitted: auto-generated Date: Fri, 16 Jan 2026 09:29:55 +0000 Message-Id: <696a0513.21585.1d15848@gitrepo.freebsd.org> The branch stable/14 has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=296ebf7b8a50b24b4950b7bd92e170ee224e6671 commit 296ebf7b8a50b24b4950b7bd92e170ee224e6671 Author: Brooks Davis AuthorDate: 2026-01-09 14:19:49 +0000 Commit: Brooks Davis CommitDate: 2026-01-16 09:25:03 +0000 iflib: remove convoluted custom zeroing code Replace a collection of aliasing violations and ifdefs with memset (which now expands to __builtin_memset and should be quite reliably inlined.) The old code is hard to maintain as evidenced by the most recent change to if_pkt_info_t updating the defines, but not the zeroing code. Reviewed by: gallatin, erj Effort: CHERI upstreaming Sponsored by: Innovate UK Fixes: 43d7ee540efe ("iflib: support for transmit side nic KTLS offload") Differential Revision: https://reviews.freebsd.org/D54605 (cherry picked from commit 31e7dc6b9a000b02353bfc41cbd897533287cda2) --- sys/net/iflib.c | 65 +++++---------------------------------------------------- 1 file changed, 5 insertions(+), 60 deletions(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 65d383e2d51e..0a90c417cc80 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -474,61 +474,6 @@ typedef struct if_rxsd { iflib_fl_t ifsd_fl; } *if_rxsd_t; -/* multiple of word size */ -#ifdef __LP64__ -#define PKT_INFO_SIZE 6 -#define RXD_INFO_SIZE 5 -#define PKT_TYPE uint64_t -#else -#define PKT_INFO_SIZE 11 -#define RXD_INFO_SIZE 8 -#define PKT_TYPE uint32_t -#endif -#define PKT_LOOP_BOUND ((PKT_INFO_SIZE / 3) * 3) -#define RXD_LOOP_BOUND ((RXD_INFO_SIZE / 4) * 4) - -typedef struct if_pkt_info_pad { - PKT_TYPE pkt_val[PKT_INFO_SIZE]; -} *if_pkt_info_pad_t; -typedef struct if_rxd_info_pad { - PKT_TYPE rxd_val[RXD_INFO_SIZE]; -} *if_rxd_info_pad_t; - -CTASSERT(sizeof(struct if_pkt_info_pad) == sizeof(struct if_pkt_info)); -CTASSERT(sizeof(struct if_rxd_info_pad) == sizeof(struct if_rxd_info)); - -static inline void -pkt_info_zero(if_pkt_info_t pi) -{ - if_pkt_info_pad_t pi_pad; - - pi_pad = (if_pkt_info_pad_t)pi; - pi_pad->pkt_val[0] = 0; pi_pad->pkt_val[1] = 0; pi_pad->pkt_val[2] = 0; - pi_pad->pkt_val[3] = 0; pi_pad->pkt_val[4] = 0; pi_pad->pkt_val[5] = 0; -#ifndef __LP64__ - pi_pad->pkt_val[6] = 0; pi_pad->pkt_val[7] = 0; pi_pad->pkt_val[8] = 0; - pi_pad->pkt_val[9] = 0; pi_pad->pkt_val[10] = 0; -#endif -} - -static inline void -rxd_info_zero(if_rxd_info_t ri) -{ - if_rxd_info_pad_t ri_pad; - int i; - - ri_pad = (if_rxd_info_pad_t)ri; - for (i = 0; i < RXD_LOOP_BOUND; i += 4) { - ri_pad->rxd_val[i] = 0; - ri_pad->rxd_val[i + 1] = 0; - ri_pad->rxd_val[i + 2] = 0; - ri_pad->rxd_val[i + 3] = 0; - } -#ifdef __LP64__ - ri_pad->rxd_val[RXD_INFO_SIZE - 1] = 0; -#endif -} - /* * Only allow a single packet to take up most 1/nth of the tx ring */ @@ -1036,7 +981,7 @@ iflib_netmap_txsync(struct netmap_kring *kring, int flags) if (nm_i != head) { /* we have new packets to send */ uint32_t pkt_len = 0, seg_idx = 0; int nic_i_start = -1, flags = 0; - pkt_info_zero(&pi); + memset(&pi, 0, sizeof(pi)); pi.ipi_segs = txq->ift_segs; pi.ipi_qsidx = kring->ring_id; nic_i = netmap_idx_k2n(kring, nm_i); @@ -1229,7 +1174,7 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int flags) nm_i = netmap_idx_n2k(kring, nic_i); MPASS(nm_i == kring->nr_hwtail); for (n = 0; avail > 0 && nm_i != hwtail_lim; n++, avail--) { - rxd_info_zero(&ri); + memset(&ri, 0, sizeof(ri)); ri.iri_frags = rxq->ifr_frags; ri.iri_qsidx = kring->ring_id; ri.iri_ifp = ctx->ifc_ifp; @@ -2992,7 +2937,7 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) /* * Reset client set fields to their default values */ - rxd_info_zero(&ri); + memset(&ri, 0, sizeof(ri)); ri.iri_qsidx = rxq->ifr_id; ri.iri_cidx = *cidxp; ri.iri_ifp = ifp; @@ -3658,7 +3603,7 @@ iflib_encap(iflib_txq_t txq, struct mbuf **m_headp) } m_head = *m_headp; - pkt_info_zero(&pi); + memset(&pi, 0, sizeof(pi)); pi.ipi_mflags = (m_head->m_flags & (M_VLANTAG | M_BCAST | M_MCAST)); pi.ipi_pidx = pidx; pi.ipi_qsidx = txq->ift_id; @@ -4301,7 +4246,7 @@ iflib_if_transmit(if_t ifp, struct mbuf *m) if (ctx->isc_txq_select_v2) { struct if_pkt_info pi; uint64_t early_pullups = 0; - pkt_info_zero(&pi); + memset(&pi, 0, sizeof(pi)); err = iflib_parse_header_partial(&pi, &m, &early_pullups); if (__predict_false(err != 0)) {