From nobody Fri Jan 16 09:29:43 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 4dsvh81WHMz6P2CZ for ; Fri, 16 Jan 2026 09:29:44 +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 4dsvh76FdRz3cfk for ; Fri, 16 Jan 2026 09:29:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1768555783; 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=PcOyw9Ed0SqVwp5s56Ais+pDaV+IjUB2+S8gQ3/bnfg=; b=Eq7PJFXtXNsysE8URknCodDY5oFRvnPOODZf6Skwhqrlxnth1QYxHD+5KPHoWpZucRJaGc YCIbe0YjAuAeAVk39kjMp1nSL7zUKcOp0K79I3QSNQBtTHah/AHSVHDVegF/3sGYjKtf/n Fu6zhMvT20wA+2tIx+XUVSA/OL6ZbabBW8s9pxVk60xUei5bN3UF9gbac2bSwuqPbcUj49 qPBX7SikUHgHATDkU3kADX3+rKEb6lFFnYQRagcjbW0BtGS0G7fSyxPYSmEK8/ZkUlOi6k 3VEnV1KwRPZLNn8WX2fFKoZbloz6qNG1AdngN1IWxtlhnC53dAX8mSdPIJxmyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1768555783; 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=PcOyw9Ed0SqVwp5s56Ais+pDaV+IjUB2+S8gQ3/bnfg=; b=gOUxnbf1p+GHScvs+DdAd0hmhI/1RCIpYcGgaaX1D/0Db6ymkcUeQEbkIe0/xN66IFd8/z 3iwqvkOKt3ecjAYE/VywmNgnaIRegCPEnUC7qH43AzDoyWgFB7vSYz0H51i7wD/nF4ltMH vyw2sPQqsEjcs3GOqWehZMlEIxpQkqj87MvMGPgjlBnivMtGptPuPf8OplZTpB+gvmKNDN 88sImNPR9/jOMByHGRTcZ6wEvKuG1hvIwfvd78SBRw+p90tJJm7uE6A/F2f8cA2VLMcxJI tUaEqFBodAxiOx3oh7/x+wLUrKRXUVpVgXR4DrMki86xX+dxI5Loia0Wu6G1/w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1768555783; a=rsa-sha256; cv=none; b=f+ld5wOF5GkVBbLq50522qXB1rdDRUnEigIMVxPbuLxW1ogNKzd6Vms5NTbMrDOY6ph/fV lczY6SEM0p62/oq+5djpga8rHnyJP3jkWSvkQjIlHvEEGw79p7lqdatfbt4LvRx2T+FcrW Tbv1EFRMP4PghEAqrr3eKI6Y+KZ+WVsZkBVhqStYRSkXzP9Wij4EO5pAXzsgAXKgIVfpBR pXxzH1Htwj2mZyTn1xkk+73hWtrwy+GF45I41mgnD8Hc4Od6t/AHSDREebk+IXubG6Mwvs +D4+nm8wOYcdJzXevIpSvTuUB2q8yBMGEDAUxiSxlO97ay0HNByorc5RKRHy7w== 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 4dsvh75Hp6z17JY for ; Fri, 16 Jan 2026 09:29:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 204ee by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 16 Jan 2026 09:29:43 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Brooks Davis Subject: git: 484edabb9455 - stable/15 - 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/15 X-Git-Reftype: branch X-Git-Commit: 484edabb945582de7e212ff3f3b1ec889070dc50 Auto-Submitted: auto-generated Date: Fri, 16 Jan 2026 09:29:43 +0000 Message-Id: <696a0507.204ee.388f0e6a@gitrepo.freebsd.org> The branch stable/15 has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=484edabb945582de7e212ff3f3b1ec889070dc50 commit 484edabb945582de7e212ff3f3b1ec889070dc50 Author: Brooks Davis AuthorDate: 2026-01-09 14:19:49 +0000 Commit: Brooks Davis CommitDate: 2026-01-16 09:25:07 +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 308ecad0a846..2b8d0901032f 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -477,61 +477,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 */ @@ -1040,7 +985,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); @@ -1233,7 +1178,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; @@ -2957,7 +2902,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; @@ -3572,7 +3517,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; @@ -4223,7 +4168,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)) {